Home >>Python File Methods >Python File seekable() Method

Python File seekable() Method

Python File seekable() Method

Python File seekable() Method in python file is used to allow access to the file stream , like the seek() method and if the file is seekable returns true, otherwise false.

Syntax:
file.seekable()
Here is an example of Python File seekable() Method:

z = open("myfile.txt", "r")
print(z.seekable())

Output:
True
Example 2:

X = open("myfile1.txt", "r")
print(X.seekable())

Output:
True

No Sidebar ads