i want to ask about tell() method. So, have code like this
op = open('data.txt', 'r')
pos = op.tell()
data = op.readline()
key = []
while data:
pos = op.tell()
data = op.readline()
key.append(pos)
and the result
key[:3]
[[87], [152], [240]]
i want my key value start from 0 since it's the first pointer position for the beginning of the sentence. but it starts from the starting pointer value for 2nd sentence. sorry, i'm new to python.
the data looks like this. it's containing few rows
Sanjeev Saxena#Parallel Integer Sorting and Simulation Amongst CRCW Models.
Hans Ulrich Simon#Pattern Matching in Trees and Nets.
Nathan Goodman#Oded Shmueli#NP-complete Problems Simplified on Tree Schemas.
In the comments I realized our mistake... The
while datacondition requires you to have read a chunk of text, I think the correct way will be to use awhile Trueloop and break on completion.this way stores the final (trailing)
posas well if you only want the start of a row, use this