When I open a text file in python to read it, the first time I call f.read()
it works fine but any subsequent calls it returns an empty string (''
). Even using it again in a single line will change it to the blank string.
The text I'm reading is a random collection of unicode characters between 0 and 128, if that helps.
for example:
>>> f = open("Data.txt")
>>> f.read()
'$$$\x00\x00\x11$$$'
>>> f.read()
''
>>> f.close()
What's causing this and how do I fix it?