File isatty() Method in Python 3
The method isatty() returns True if the file is
connected (is associated with a terminal device) to a tty(-like) device, else False.
Syntax
fileObject.isatty()
|
Return Value
This method returns true if the file is
connected (is associated with a terminal device) to a tty(-like) device, else
false.
Example
#!/usr/bin/python3
# Open
a file
fo =
open("foo.txt", "wb")
print
("Name of the file: ", fo.name)
ret =
fo.isatty()
print
("Return value : ", ret)
# Close
opend file
fo.close()
|
When we run the above program, it produces the
following result-
Name of
the file: foo.txt
Return
value : False
|