ungetc in Python
- by Dragos Toader
Some file read (readlines()) functions in Python
copy the file contents to memory (as a list)
I need to process a file that's too large to
be copied in memory and as such need to use
a file pointer (to access the file one byte
at a time) -- as in C getc().
The additional requirement I have is that
I'd like to rewind the file pointer to previous
bytes like in C ungetc().
Is there a way to do this in Python?
Also, in Python, I can read one line at a
time with readline()
Is there a way to read the previous line
going backward?