Chapters
Python114 chapters

ReferenceFile methods

file.tell()

The current position in the file.

Signature

f.tell()

Returns

An int.

Example

Python
with open("notes.txt", "w", encoding="utf-8") as f:
    f.write("Ada")

with open("notes.txt", encoding="utf-8") as f:
    print(f.tell())
    f.read(2)
    print(f.tell())

Output

0
2

See also