Nishu

nishumsn03@gmail.com

What is Tell() and seek() functions ??

Posted on February 19, 2021



tell() function is using for telling the file pointer location but seek() is used for reset the file pointer.

Example-

f= open("fileName.txt")

print(f.tell()) #output 0

print(f.readline()) #output Reading 1 line.(This is good Idea)

print(f.tell()) #18

print(f.readline())

# Seek() Function

f= open("Nishu.txt")

print(f.readline())

print(f.seek(0))

print(f.readline())

print(f.seek(11))

print(f.readline())


Sign In for comment and like the post.
admin

Nice explanation!