#!/usr/bin/env python3 import sys for line in sys.stdin: print(line,end="",flush=True)
Monday, June 20, 2016
If you want to read lines from the standard input until End-Of-File (eof), you can use the sys.stdin, for example:
Print automatically adds a new line after printing its input variables and/or constants. To avoid this new line in Python2.6+ you can add a colon "," (without quotes) after the printing command, here is an example
In Python3, you can add the option end="". Example:
print 'Hello', print 'World'
Remember that from Python2.6+ you also can use the Python3 print command, adding
from __future__ import print_function