Hi there!

How do I check if stdin is empty? This is how I write in the terminal to call my program:

>> cat file.txt | python script.py

/flaerpen

I found the solution by myself.

use sys.stdin.isatty() to find out whether the script is executed as a part of pipeline or standalone.
The method should return True if stdin is connected to a terminal, and False otherwise (pipeline or file redirection).

Thanks for the information!