Python file isatty() method

حالة

تحقق من whether file is connected to terminal device:

f = open("demofile.txt", "r")
print(f.isatty())

حالة التنفيذ

التعريف والاستخدام

إذا كان مسار التدفق هو التفاعلي، فإن دالة isatty() تعود True، مثلًا: تم الاتصال بالجهاز الت终端.

语法

file.isatty()

参数值

无参数。