English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
isatty() The method checks whether the file is connected to a terminal device, and returns True if it is, otherwise returns False.
The syntax of the isatty() method is as follows:
fileObject.isatty();
None
Returns True if connected to a terminal device, otherwise returns False.
The following example demonstrates the use of the isatty() method:
# Open the file fo = open("w3codebox.txt, "wb") print("File name: ", fo.name) ret = fo.isatty() print("Return value: ", ret) # Close the file fo.close()
The output result of the above example is as follows:
File name: w3codebox.txt Return value: False