input(prompt)
is basically equivalent to
def input(prompt):
print(prompt, end='', file=sys.stderr)
return sys.stdin.readline()
You can read directly from sys.stdin
if you like.
lines = sys.stdin.readlines()
lines = [line for line in sys.stdin]
five_lines = list(itertools.islice(sys.stdin, 5))
The first two require that the input end somehow, either by reaching the end of a file or by the user typing Control-D (or Control-Z in Windows) to signal the end. The last one will return after five lines have been read, whether from a file or from the terminal/keyboard.