Im new to python and I need some help from you guys.
So this is my Code
Tk().withdraw()
filename = askopenfilename(title='Choose a file', filetypes=[("Text Files", "*.txt")])
f = open(filename)
with open(filename,'r+',encoding="UTF-8") as file:
file.write('test')
file.write('\n')
file_contents = f.read()
This is the Text File without using file.write
Im a big noob in python please help me.
And this is after using file.write
test
ig noob in python please help me.
My Goal is to append the Text to the top of the text file without replacing the contect underneath it.