import sys def while_stdin(func): while True: line = sys.stdin.readline() if line is "": break func(line[:-1])