橘子味的心
标题:Python3 os 模块 Isatty 方法

Python3 os 模块 Isatty 方法

#!/usr/bin/python3
import os, sys

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

# Write one string
line = "This is test"
b = line.encode()
os.write(fd, b)

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

print ("Returned value is: ", ret)

# Close opened file
os.close( fd )

目录

分类