Run function from the command line and pass arguments to function
Question: I'm using similar approach to call python function from my shell script:

    
    
    python -c 'import foo; print foo.hello()'
    

But I don't know how in this case I can pass arguments to python script and
also is it possible to call function with parameters from command line?


Answer: 
    python -c 'import foo, sys; print foo.hello(); print(sys.argv[1])' "This is a test"
    

or

    
    
    echo "Wham" | python -c 'print(raw_input(""));'
    

There's also [argparse](http://docs.python.org/3/library/argparse.html) (py3
link) that could be used to capture arguments, such as the `-c` which also can
be found at `sys.argv[0]`.

A second library do exist but is discuraged, called `getopt.getopt`.

