forked from seanshoffman/python-build-cli-planner-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
25 lines (18 loc) · 620 Bytes
/
Copy pathdatabase.py
File metadata and controls
25 lines (18 loc) · 620 Bytes
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
import csv
from src.deadlined_reminders import DeadlinedReminder
def list_reminders():
f = open("reminders.csv", "r")
with f:
reader = csv.reader(f)
for row in reader:
print()
for e in row:
print(e.ljust(32), end=' ')
print()
def add_reminder(text, date, ReminderClass):
reminder = ReminderClass(text, date)
if not isinstance(reminder, DeadlinedReminder):
raise TypeError('Invalid Reminder Class')
with open('reminders.csv', 'a+', newline='\n') as file:
writer = csv.writer(file)
writer.writerow(reminder)