Python: Read STDIN
import sys data = sys.stdin.read() print(data) # if there is no stdin, the program hangs.
import sys # Read all lines into a list # each line ends with newline character xlines = sys.stdin.readlines() print(xlines) # if there is no stdin, the program hangs.