Latest web development tutorials

Python3 Berkas Fileno () metode

Python3 Berkas metode (File) Python3 Berkas metode (File)


garis besar

Fileno () metode mengembalikan file bilangan bulat descriptor (file descriptor FD Integer) dapat digunakan untuk sistem operasi yang mendasari I / O operasi.

tatabahasa

Metode Fileno () memiliki sintaks berikut:

fileObject.fileno(); 

parameter

  • tidak

Kembali Nilai

Mengembalikan file descriptor.

contoh

Contoh berikut menunjukkan () metode Fileno penggunaan:

#!/usr/bin/python3

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

fid = fo.fileno()
print ("文件描述符为: ", fid)

# 关闭文件
fo.close()

Contoh di atas output:

文件名为:  w3big.txt
文件描述符为:  3

Python3 Berkas metode (File) Python3 Berkas metode (File)