>>> import sys >>> >>> text = sys.stdin.read() abc def ghi >>> text 'abc\ndef\nghi\n' >>> print(text) abc def ghi >>>