Skip to content

Commit

Permalink
This commit introduces a simple task manager script that allows users…
Browse files Browse the repository at this point in the history
… to add, view, and manage daily tasks. Features implemented include loading and saving tasks to a CSV file, adding new tasks with deadlines, and displaying all tasks. This setup helps streamline daily planning and task tracking.
  • Loading branch information
sachinrafic committed Apr 20, 2024
1 parent cbda082 commit f12b300
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions TaskManager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import datetime
import csv

def load_tasks(filename='tasks.csv'):
tasks = []
with open(filename, 'r', newline='') as file:
reader = csv.reader(file)
for row in reader:
tasks.append({'task': row[0], 'deadline': row[1], 'completed': row[2]})
return tasks

def save_tasks(tasks, filename='tasks.csv'):
with open(filename, 'w', newline='') as file:
writer = csv.writer(file)
for task in tasks:
writer.writerow([task['task'], task['deadline'], task['completed']])

def add_task(task, deadline):
tasks = load_tasks()
tasks.append({'task': task, 'deadline': deadline, 'completed': 'No'})
save_tasks(tasks)
print("Task added successfully!")

def show_tasks():
tasks = load_tasks()
for task in tasks:
print(f"Task: {task['task']}, Deadline: {task['deadline']}, Completed: {task['completed']}")

# Example usage
add_task('Write daily report', '2024-04-20')
show_tasks()

0 comments on commit f12b300

Please sign in to comment.