I have this loop that reads lines from stdin until a newline is entered, however, this only works from typing in the input. How do I get the program to read lines from a redirec
As others have mentioned, probably your condition line == '\n' never holds true. The proper solution would be to use a loop like:
line == '\n'
for line in sys.stdin: stripped = line.strip() if not stripped: break lines.append(stripped)