Pipe Output to Python File
Question: How do a make a python script take input that has been piped to it. Is that a
`sys.argv` moment. To be clear I want to figure out how to code the python
side to receive input like this:

    
    
    cat someFile | domeSomething.py
    

Can this be done? Again, to clarify, I'm not wanting to write this as passing
a filename to my script and then using `open(filename)` I want to get piped
input. Thanks for the help.


Answer: To get piped input, you need to read from `stdin`:

    
    
    import sys
    print sys.stdin.read()
    

`stdin` is a file, so feel free to use any of the [methods of a file
object](http://docs.python.org/2/library/stdtypes.html#file-objects).

