File Random Access : File seek « File « Python






File Random Access


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')
f.read()


           
       








Related examples in the same category

1.Use seek() to move file pointer