Python File isatty() Method

❮ File Methods


Example

Check if the file is connected to a terminal device:

f = open("demofile.txt", "r")
print(f.isatty())
Run Example »

Definition and Usage

The isatty() method returns True if the file stream is interactive, example: connected to a terminal device.


Syntax

file.isatty()

Parameter Values

No parameters


❮ File Methods

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