|
7 | 7 | p+=1
|
8 | 8 | no_of_items=p-2
|
9 | 9 | except:
|
10 | | - f=open("todolist.txt",'w') |
| 10 | + f=open("./TODO (CLI-VER)/todolist.txt",'w') |
11 | 11 | f.write("_________TODO LIST__________\n")
|
12 | 12 | f.write(" TIME WORK")
|
13 | 13 | finally:
|
14 | 14 | f.close()
|
15 | 15 | #Todo list
|
16 | | - |
17 | 16 | print("Press 1: Add Item \nPress 2: Delete Item \nPress 3: Update item \nPress 4: Display Items\nPress 5: Exit")
|
18 | 17 | n=int(input())
|
19 | | - |
20 | | - |
21 | 18 | while n==1 or n==2 or n==3 or n==4:
|
22 | 19 | if n==1:
|
23 | 20 | todo=[]
|
|
26 | 23 | print("Enter your Work")
|
27 | 24 | work=input()
|
28 | 25 | no_of_items+=1
|
29 | | - with open('todolist.txt','a') as f: |
| 26 | + with open('./TODO (CLI-VER)/todolist.txt','a') as f: |
30 | 27 | f.write("\n"+str(no_of_items)+" "+time+" "+work)
|
31 | 28 | elif n==2:
|
32 | 29 | if(no_of_items<=0):
|
|
35 | 32 | print("____________________________________________________________")
|
36 | 33 | print("Your Current List: ")
|
37 | 34 | todo=[]
|
38 | | - with open('todolist.txt') as f: |
| 35 | + with open('./TODO (CLI-VER)/todolist.txt') as f: |
39 | 36 | for i in f.readlines():
|
40 | 37 | print(i)
|
41 | 38 | todo.append(i)
|
|
49 | 46 | else:
|
50 | 47 |
|
51 | 48 | todo.pop(pos+1)
|
52 | | - |
53 | 49 | no_of_items-=1
|
54 | 50 | if(no_of_items<=0):
|
55 | 51 | print("Congratulations your todo list is empty!")
|
56 | 52 |
|
57 | | - with open('todolist.txt','w') as f: |
| 53 | + with open('./TODO (CLI-VER)/todolist.txt','w') as f: |
58 | 54 | for i in range(len(todo)):
|
59 | 55 | if i>=(pos+1):
|
60 | 56 | f.write(str(pos)+todo[i][1:])
|
|
66 | 62 | print("____________________________________________________________")
|
67 | 63 | print("Your Current List: ")
|
68 | 64 | todo=[]
|
69 | | - with open('todolist.txt') as f: |
| 65 | + with open('./TODO (CLI-VER)/todolist.txt') as f: |
70 | 66 | for i in f.readlines():
|
71 | 67 | print(i)
|
72 | 68 | todo.append(i)
|
|
86 | 82 | time=input()
|
87 | 83 | p=todo[pos+1].index(":")
|
88 | 84 | y=0
|
89 | | - with open('todolist.txt','w') as f: |
| 85 | + with open('./TODO (CLI-VER)/todolist.txt','w') as f: |
90 | 86 | for i in range(len(todo)):
|
91 | 87 | if i==pos+1:
|
92 | 88 | f.write(str(pos)+" "+time+""+''.join(todo[pos+1][p+3:]))
|
|
97 | 93 | work=input()
|
98 | 94 | p=todo[pos+1].index(":")
|
99 | 95 | y=0
|
100 | | - with open('todolist.txt','w') as f: |
| 96 | + with open('./TODO (CLI-VER)/todolist.txt','w') as f: |
101 | 97 | for i in range(len(todo)):
|
102 | 98 | if i==pos+1:
|
103 | 99 | f.write(str(pos)+" "+''.join(todo[pos+1][p-2:p+3])+" "+work)
|
|
107 | 103 | print("Your Current List: ")
|
108 | 104 | todo=[]
|
109 | 105 | print("____________________________________________________________")
|
110 | | - with open('todolist.txt') as f: |
| 106 | + with open('./TODO (CLI-VER)/todolist.txt') as f: |
111 | 107 | for i in f.readlines():
|
112 | 108 | print(i)
|
113 | 109 | todo.append(i)
|
|
0 commit comments