Is there a Python file type for accessing random lines without traversing the whole file? I need to search within a large file, reading the whole thing into memory wouldn't be possible.
Any types or methods would be appreciated.
Is there a Python file type for accessing random lines without traversing the whole file? I need to search within a large file, reading the whole thing into memory wouldn't be possible.
Any types or methods would be appreciated.
The File object supports seek but make sure that you open them as binary, i.e. "rb".
You may also wish to use the mmap module for random access, particularly if the data is in an internal format already.