readers.file_reader: base file reading utilities
-
class
BaseReader(obj)[source] Common base for
FileReaderandZipReader. In fact, it is a very thin wrapper aroundIO-alike object, to read it line by line and:strip lines transparently
ignore BOM (byte-order mark) at the beginning
yield line with its number (1-based)
support encoding change on the fly:
for line in reader: # do something reader.reset_encoding('UTF-8') # ..continue to read from the same line