-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjob_tracker.py
More file actions
32 lines (27 loc) · 1.02 KB
/
job_tracker.py
File metadata and controls
32 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import csv
from datetime import datetime
class Job:
def __init__(self, company, role, status="Applied"):
self.company = company
self.role = role
self.status = status
self.date = datetime.today().strftime('%Y-%m-%d')
def to_list(self):
return [self.company, self.role, self.status, self.date]
class JobTracker:
def __init__(self, filename="job_data.csv"):
self.filename = filename
def add_job(self, job):
with open(self.filename, "a", newline="") as file:
writer = csv.writer(file)
writer.writerow(job.to_list())
def view_jobs(self):
try:
with open(self.filename, "r") as file:
reader = csv.reader(file)
print("\nCompany | Role | Status | Date Applied")
print("---------------------------------------")
for row in reader:
print(" | ".join(row))
except FileNotFoundError:
print("No job data found. Add some jobs first.")