THE WORLD'S LARGEST WEB DEVELOPER SITE

Python File fileno() Method

❮ File Methods


Example

Return the file descriptor of the stream:

f = open("demofile.txt", "r")
print(f.fileno())
Run example »

Definition and Usage

The fileno() method returns the file descriptor of the stream, as a number.

An error will occur if the operator system does not use a file descriptor.


Syntax

file.fileno()

Parameter Values

No parameters


❮ File Methods