file.seekable() Is seekable
Last updated: 2026-09-22
file.seekable() Is seekable
file.seekable() returns whether the file supports random access (seek).
| Category | File Methods |
|---|---|
| Kind | Built-in Type Method |
| Python Version | all |
📝 Syntax
file.seekable()
Returns:bool. True if the file supports random access (seek), else False.
Mutates the original:No (returns a new object)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
True
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QWhat does seekable() check?
AWhether the file supports random positioning (seek). Regular disk files are True; pipes, terminals, and other streams are False.
QWhat is it useful for?
AChecking before calling seek() to avoid OSError.
QWhich files are not seekable?
AStreams such as pipes and terminals are usually not seekable, so seekable() returns False.