Consider the following script
#!/usr/bin/env python
# foo.py
import sys
print sys.argv
When I run this in a terminal with arguments, here is the output
$ ./foo.py -h hello -m "this is a string"
['./foo.py', '-h', 'hello', '-m', 'this is a string']
My question is: is there a function in python's standard library, which, given the string ./foo.py -h hello -m "this is a string"
produces the list ['./foo.py', '-h', 'hello', '-m', 'this is a string']
in the same way as the interpreter does when it builds sys.argv ?