Tutorials Point


  Python Basics
  Python Advanced
  Python Useful References
  Python Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Python os.isatty() Method


previous next AddThis Social Bookmark Button


Description:

This method returns True if the file descriptor fd is open and connected to a tty(-like) device, else False.

Syntax:

os.isatty( fd )

Parameters:

Here is the detail of parameters:

  • fd: This is the file descriptor for which association needs to be checked.

Example:

#!/usr/bin/python

import os, sys

# Open a file
fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT )

# Write one string
os.write(fd, "This is test")

# Now use isatty() to check the file.
ret = os.isatty(fd)

print "Returned value is: ", ret

# Close opened file
os.close( fd )

This would produce following result:

Returned value is:  False


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names