YouTip LogoYouTip

Python3 File Fileno

# Python3.x Python3 File fileno() Method [![Image 3: Python3 File Methods](#) Python3 File Methods](#) * * * ### Overview The **fileno()** method returns an integer file descriptor (FD integer) that can be used for low-level I/O operations by the operating system. ### Syntax The syntax for the fileno() method is as follows: fileObject.fileno(); ### Parameters * **None** ### Return Value Returns the file descriptor. ### Example The following example demonstrates the use of the fileno() method: #!/usr/bin/python3# Open the file fo = open("tutorial.txt", "wb")print ("File name: ", fo.name) fid = fo.fileno()print ("File descriptor: ", fid)# Close the file fo.close() The output of the above example is: File name: tutorial.txt File descriptor: 3 * * Python3 File Methods](#)
← Python3 File NextPython3 File Close β†’