By Pankaj Singh Last updated : September 17, 2023 In Python, to read a file from the given index, you need to use mainly two methods tellg() and seek() of the File object.tell() MethodThis method returns the current position of file pointer within the file.Syntaxfile_object.tell() s...
Theseekmethod will move the pointer. In this example first we create a file and then open it and fool around withtellandseekfor no particular reason just to show how they work. examples/python/seek.py importos filename ='/tmp/data.txt'withopen(filename,'w')asfh: fh.write("Hello Worl...