Created
February 4, 2019 17:26
-
-
Save jangia/a9db47b77a8021bcb6e4b5ff150e7e6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
with open('tasks.csv', mode='r') as infile: | |
reader = csv.reader(infile) | |
tasks = [{'task': row[0], 'done': row[1]} for row in reader] | |
print tasks | |
incomplete = [task for task in tasks if task['done'] == 'ne'] | |
while incomplete: | |
action = raw_input('uredi/dodaj') | |
if action == 'uredi': | |
for task in incomplete: | |
done = raw_input('Je opravilo: %s narejeno?(da/ne)' % task['task']) | |
task['done'] = done | |
else: | |
task = raw_input('Opis taska: ') | |
narejeno = raw_input('Narejeno?') | |
task_dict = { | |
'task': task, | |
'done': narejeno | |
} | |
tasks.append(task_dict) | |
incomplete = [task for task in tasks if task['done'] == 'ne'] | |
nadaljuj = raw_input('Nadaljuj?') | |
if nadaljuj != 'da': | |
break | |
with open('tasks.csv', 'w') as csv_file: | |
writer = csv.writer(csv_file) | |
writer.writerows([[task['task'], task['done']] for task in tasks]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment