You can easily explore it yourself ...
# exploring Python's file random access
text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
fname = 'test103.txt'
# create a test file
fout = open(fname, "w")
fout.write(text)
fout.close()
# open the test file for reading
fin = open(fname, "r")
# file positions are zero based
# tell the current file position
print( fin.tell() ) # 0
# read the byte at that position
print( fin.read(1) ) # A
# after reading 1 byte the position has advanced by 1
print( fin.tell() ) # 1
# read the next byte
print( fin.read(1) ) # B
print( fin.tell() ) # 2
# move the position to 10
fin.seek(10)
# read the byte at position 10
print( fin.read(1) ) # K
fin.close()
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
Offline 5,792 posts
since Oct 2004