Код: Выделить всё
def getTodo():
with open('todo.txt', 'r') as file:
todo = file.readlines()
return todo
def writeTodo():
with open('todo.txt', 'w') as file:
file.writelines(todo)
def getInp():
x = input("add, edit, show or complete : ").strip("\n").lower()
return x
while True:
_inp = getInp()
if "add" or "new" in _inp:
todo = getTodo()
task = _inp[3:] + "\n"
todo.append(task)
writeTodo()
elif "exit" in _inp:
exit()`
Подробнее здесь: https://stackoverflow.com/questions/790 ... s-an-input