Memory efficient way of reading files line-by-line from the end of file
- Free software: MIT license
- Documentation: https://file-read-backwards.readthedocs.io.
This package is for reading file backward line by line as unicode in a memory efficient manner for both Python 2.7 and Python 3.
It currently supports ascii, latin-1, and utf-8 encodings.
It supports "\r", "\r\n", and "\n" as new lines.
An example of using file_read_backwards for python2.7:
#!/usr/bin/env python2.7
from file_read_backwards import FileReadBackwards
f = FileReadBackwards("/tmp/file", encoding="utf-8")
# getting lines by lines starting from the last line up
for l in f:
print l
# do it again
for l in f:
print l
Another example using python3.3:
#!/usr/bin/env python3.3
from file_read_backwards import FileReadBackwards
f = FileReadBackwards("/tmp/file", encoding="utf-8")
# getting lines by lines starting from the last line up
for l in f:
print(l)
# do it again
for l in f:
print(l)
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.