Python3 os 模块 Isatty 方法 Python3 while else 循环 Python3 os 模块 Link 方法 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 ) Python3 while else 循环 Python3 os 模块 Link 方法