Showing posts with label sys. Show all posts
Showing posts with label sys. Show all posts

Monday, June 20, 2016

Reading lines till eof from standard input

If you want to read lines from the standard input until End-Of-File (eof), you can use the sys.stdin, for example:
#!/usr/bin/env python3
import sys

for line in sys.stdin:
    print(line,end="",flush=True)