How do I check if stdin has some data?
On Unix systems you can do the following: import sys import select if select.select([sys.stdin, ], [], [], 0.0)[0]: print(“Have data!”) else: print(“No data”) On Windows the select module may only be used with sockets though so you’d need to use an alternative mechanism.