English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
fileno() The method returns an integer file descriptor (file descriptor FD integer) that can be used for low-level operating system I/O operation.
fileno() method syntax is as follows:
fileObject.fileno();
None
Return the file descriptor.
The following example demonstrates the use of the fileno() method:
# Open the file fo = open("w3codebox.txt, "wb") print("File name: ", fo.name) fid = fo.fileno() print("File descriptor is: ", fid) # Close the file fo.close()
The output result of the above example is:
File name: w3codebox.txt File descriptor is: 3