How can I use raw_input to receive input from stdin in python 2.7?
Question: To receive input from stdin in python 2.7, I typically `import sys` and use
`sys.stdin`. However, I have seen examples where `raw_input` is used to
receive input from stdin, including multi-line input. How exactly can I use
raw_input in place of sys.stdin? Here is an example problem:

input.txt:

    
    
    Print
    me
    out
    

And I am running this command:

    
    
    cat input.txt | python script.py
    

What can I put in script.py such that it will print out all lines of input
using `raw_input`?


Answer: You can do something like this:

    
    
    while True:
        try:
            print raw_input()
        except EOFError:
            break
    

`raw_input` will only return single lines from stdin, and throws `EOFError`
when EOF is read.

