Random accesss file : seek « File « Python Tutorial






f = open(r'c:\text\somefile.txt', 'w')
f.write('01234567890123456789')
f.seek(5)
f.write('Hello, World!')
f.close()
f = open(r'c:\text\somefile.txt')
print f.read()
f = open(r'c:\text\somefile.txt')
print f.read(3)
print f.read(2)
print f.tell()








12.14.seek
12.14.1.Random accesss file
12.14.2.Move around within the file using seek().