-3

I am making a To-do app and the priority,status,time left to finish and the name is saved in a CSV file.When the status is updated the the CSV file status should also be updated this is the code when the CSV file is not getting updated:

def mark_task():
    global freetime
    print("You selected Option 5.")
    #Counting the tasks
    count2 = 0
    for i, row in enumerate(mytask):
            count2 += 1
            print(count2,".",row['task_name'],".status: ",row['status'])
    task_nam = input("Select the task you want to update: ")
    status = input("Enter status(Pending/Completed): ")
    #marking tasks
    for i, row in enumerate(mytask):
        if row['task_name'] == task_nam:
            row['status'] = status
            print(f'Status {status} updated for the task {row['task_name']}')
            freetime += 1
            break
        elif row['task_name'] != task_nam:
            print(f"Record Not found in the dictionary {task_nam}")
            break

so I want it to update in the CSV file when the task gets updated in the code

3
  • 1
    What's is the question? How to Ask and minimal reproducible example Commented Nov 24 at 4:44
  • 1
    Highly recommended reading Commented Nov 24 at 6:19
  • Since Python ships with sqlite3, why not use it as the data store. If you want to stick with CSV then read the docs here csv, they provide the information necessary to read/write CSV files. Commented Nov 24 at 15:54

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.