I wanted to seek to the start of the file of to write from the start. In the documentation of python 3.9 io.IOBase.seek it is displayed seek has a parameter "whence" yet an error is being displayed:
TypeError: TextIOWrapper.seek() takes no keyword arguments
my code is:
with open("t.txt",'a+') as f:
f.seek(0,)
print(f.readlines())
f.seek(0,whence=0)
f.write("12\n23\n32")
I have use "a+" as I want to preserve the contains of the file when it is opened as well edit later.
I wanted to edit the contains from the start that's why I used whence = 0, as it would help me edit from start of the stream