Given a large file (hundreds of MBs) I read content between a specific start and end index quickly How will Python use within the file?
Basically, I'm looking for a more efficient way to do:
open (filename) .read () [start_index: end_index]
You can find the file in the file and then read the file From there some amount of search allows you to get a specific offset within a file, and then you can read only the number of bytes in that range. With Open (filename): fin: fin It only reads the data that you are looking for. (start_index) data = fin.red (end_index -
No comments:
Post a Comment