Os Isatty
# Python2.x Python os.isatty() Method
[ Python OS File/Directory Methods](#)
* * *
### Overview
The os.isatty() method is used to determine if the file descriptor fd is open and connected to a tty(-like) device, returning True if so, otherwise False.
### Syntax
The syntax format of the **isatty()** method is as follows:
os.isatty()
### Parameters
* None
### Return Value
Returns True if the file descriptor fd is open and connected to a tty(-like) device, otherwise False.
### Example
The following example demonstrates the use of the isatty() method:
#!/usr/bin/python# -*- coding: UTF-8 -*-import os, sys # Open file fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT )# Write string os.write(fd, "This is test")# Use
YouTip