Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = "Desktop/coordinates.csv"
- index = [None]
- with open(file, "rt", encoding="utf8", newline=None) as fd:
- offset = 0
- for line_number, line in enumerate(fd, start=1):
- size = len(line)
- index.append((line_number, offset, size))
- offset += size + 1
- # index: line number starting with 1
- # offset, where to seek
- # size, how much to read the single line
- # first index is None, so the index fits to line numbering.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement