Python 文件 isatty() 方法
定义和用法
如果文件流是交互式的,则 isatty() 方法返回 True,例如:已连接到终端设备。
实例
检查文件是否已连接到终端设备:
f = open("demofile.txt", "r")
print(f.isatty())
语法
file.isatty()
参数值
无参数。
如果文件流是交互式的,则 isatty() 方法返回 True,例如:已连接到终端设备。
检查文件是否已连接到终端设备:
f = open("demofile.txt", "r")
print(f.isatty())
file.isatty()
无参数。