Python File isatty() Method
Example
Check if the file is connected to a terminal device:
f = open("demofile.txt", "r") print(f.isatty())
Definition and Usage
If the file stream is interactive, the isatty() method returns True, for example: Connected to a terminal device.
Syntax
file.isatty()
Parameter Value
No parameters.