I\'m trying to do some of the code golf challenges, but they all require the input to be taken from stdin. How do I get that in Python?
stdin
import sys for line in sys.stdin: print(line)
Note that this will include a newline character at the end. To remove the newline at the end, use line.rstrip() as @brittohalloran said.
line.rstrip()