English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
seek() The method is used to check if the file is searchable.
The syntax of the seekable() method is as follows:
file.seekable()
No parameters
If the file is searchable, the seekable() method returns True, otherwise it returns False.
If the file allows access to the file stream (such as the seek() method), then the file is searchable.
The following example demonstrates the use of the seekable() method, to check if the file is searchable:
f = open("w3codebox.txt", "r") print(f.seekable())
The output result of the above example is as follows:
True