Python3 File Tell
# Python3.x Python3 File tell() Method
[ Python3 File Methods](#)
* * *
### Overview
The **tell()** method returns the current position of the file, i.e., the current position of the file pointer.
### Syntax
The syntax for the tell() method is as follows:
fileObject.tell()
### Parameters
* **None**
### Return Value
Returns the current position of the file.
### Example
The following example demonstrates the use of the tell() method:
The content of the file .txt is as follows:
1:www. 2:www. 3:www. 4:www. 5:www.
Loop through and read the file content:
## Example (Python 3.0+)
#!/usr/bin/python3# Open the file fo = open(".txt", "r+")print("File name: ", fo.name)line = fo.readline()print("Read data: %s" % (line))# Get current file position pos = fo.tell()print("Current position: %d" % (pos))# Close the file fo.close()
The output of the above example is:
File name: .txt Read data: 1:www. Current position: 17
* * Python3 File Methods](#)
YouTip