4 ms·
Hey, this was actually easier and more fun than expected! I tried it out at the Python REPL and now I have a mostly-working implementation using os.path.getsiz
by dpritchett 16y ago
Hey, this was actually easier and more fun than expected! I tried it out at the Python REPL and now I have a mostly-working implementation using os.path.getsize(), file.tell(), file.seek(), and file.readline(). The fun part is that I hadn't used the first three of those functions in Python before today. Layering a binary search on top of this looks as easy as
*REDACTED*
with some edge case checking and start-of-next-line seeking.
I'd have thought there was more to this, but it seems pretty straightforward.
Lessons learned for me: Python standard library docs are great, repl development is great, and text files are fun.