YouTip LogoYouTip

Python3 File Fileno

# Python3.x Python3 File fileno() Method [![Image 3: Python3 File(Files) Method](#) Python3 File(Files) Method](#) * * * ### Overview The **fileno()** method returns an integer file descriptor (FD integer), which can be used for low-level I/O operations of 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 file fo = open("tutorial.txt", "wb")print ("File name: ", fo.name) fid = fo.fileno()print ("File descriptor: ", fid)# Close file fo.close() The output of the above example is: File name: tutorial.txt File descriptor: 3 * * Python3 File(Files) Method](#)
← Python3 File ReadlinePython3 File Next β†’