Python: Read STDIN

By Xah Lee. Date: .
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.

Python, Read Write File