I am working on a school project and im trying to have the homework you right down saved to a txt file so it can call upon and read later. However, everytime it goes to write something new, it clears the previous text added.
the_journal_part = input("what subject would you like to take down homework for? ")
if the_journal_part == "exit" or the_journal_part == "Exit":
print("leaving app")
time.sleep(5)
os.system("clear")
exit()
homework = input("here's where you can take down your " + the_journal_part + " homework: ")
time.sleep(2)
os.system("clear")
f = open('homework.txt', 'r')
f.read()
f = open('homework.txt', 'w')
f.write(the_journal_part + ': ' + homework )
f.close()
I have tried to make it write a null line before and after the text is written to give space but it still clears it. I've tried many things to make it work but nothing has worked. I have spent hours searching for an answer, its due in two weeks. Can anyone please help me?