-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctionsfortodo.py
More file actions
30 lines (21 loc) · 865 Bytes
/
Functionsfortodo.py
File metadata and controls
30 lines (21 loc) · 865 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
26
27
28
29
30
#Bismillah
FILEPATH = "My_todo_list.txt"
def get_todos(filepath=FILEPATH):
"""
:param filepath: Has the FILEPATH Variable (which containts the Filepath) as a default Argument
:return: returns a List with the Items in My_todo_list.txt (as default, you can give other filepaths as Arguments).
"""
with open(filepath, "r") as file_local:
todo_List = file_local.readlines()
return todo_List
def write_todos(todos_arg, filepath=FILEPATH):
"""
:param todos_arg: todo to write in the My_todo_List.txt file
:param filepath: Has the "TextFiles/My_todo_list.txt" filepath as an default Argument (as default, you can give other filepaths as Arguments)
:return:
"""
with open(filepath, "w") as file:
file.writelines(todos_arg)
if __name__ == "__main__":
print(get_todos())
print(__name__)