In this Tutorial -:

Pre-requisite: File Handling in Python
tell() function in Python
tell() function in Python is used to find the current position of the file pointer from the beginning in the given file.
f.tell()
seek() function in Python
seek() function in Python is used to bring the file pointer to the given specified position.
f.seek(offset, position)
offset: It represents how many bytes to move.
position: It represents from which position file pointer should move.
Let’s see their application with below code example:
Code Example
Consider a file sample.txt has following content in it,
Hello World
fp = open('sample.txt', 'r') # opening a file sample.txt in read mode
print(fp.read())
print(fp.tell()) # prints 11 as file pointer comes at the last position while reading file
fp.seek(2) # pulling file pointer to second position
print(fp.tell()) # prints 2 as we just seek file pointer to second position
print(fp.read()) # read content from position 2 (0-based index)
O/P
Hello World
11
2
llo World
