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

Python File isatty() Method

Python File isatty() Method

Python file isatty() method is used to return True if the file stream is interactive(connected to a terminal device) and False if not.

Syntax:
file.isatty()
Here is an example of Python isatty() method:

f = open("test.txt", "r")
print(f.isatty())

Output:
False

No Sidebar ads