Python3 File fileno () method
Outline
fileno () method returns an integer file descriptor (file descriptor FD Integer) can be used for the underlying operating system I / O operations.
grammar
fileno () method has the following syntax:
fileObject.fileno();
parameter
no
return value
Returns the file descriptor.
Examples
The following example demonstrates fileno () method of use:
#!/usr/bin/python3 # 打开文件 fo = open("w3big.txt", "wb") print ("文件名为: ", fo.name) fid = fo.fileno() print ("文件描述符为: ", fid) # 关闭文件 fo.close()
The above example output is:
文件名为: w3big.txt 文件描述符为: 3