Python 文件方法
檢查文件是否已連接到終端設備:
f = open("demofile.txt", "r") print(f.isatty())
運行實例
如果文件流是交互式的,則 isatty() 方法返回 True,例如:已連接到終端設備。
file.isatty()
無參數。