Latest web development tutorials

Metodo python3 isatty File ()

Metodo File python3 (File) Metodo File python3 (File)


contorno

metodo per rilevare file,isatty () è collegato ad un dispositivo terminale, se deve restituire true, altrimenti False.

grammatica

Metodo isatty () ha la seguente sintassi:

fileObject.isatty(); 

parametri

  • no

Valore di ritorno

Se collegato ad un dispositivo terminale restituisce True, altrimenti False.

Esempi

L'esempio seguente mostra il metodo isatty () di uso:

#!/usr/bin/python3

# 打开文件
fo = open("w3big.txt", "wb")
print ("文件名为: ", fo.name)

ret = fo.isatty()
print ("返回值 : ", ret)

# 关闭文件
fo.close()

L'output sopra esempio è:

文件名为:  w3big.txt
返回值 :  False

Metodo File python3 (File) Metodo File python3 (File)