I'm guessing you're asking about this line, since the rest are really commonly used things:
- Code: Select all
last = deque(fin, 1)
This basically iterates over the lines of the file, and adds each one to a collections.deque
with maximum length set to 1.
From the docs:
(...) the deque is bounded to the specified maximum length. Once a bounded length deque is full, when new items are added, a corresponding number of items are discarded from the opposite end.
So you end up with the last line of the file...