isatty() function in python by R4R Team

-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()


program-

#open a file
f=open('myfile.txt','w')
print("File is ",f.name)

s=f.isatty()
print("Returned value of isatty() is",s)

#close file
f.close()


output-

File is myfile.txt
Returned value of isatty() is False




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!