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

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.