I am using getopt to process a command line optional argument, which should accept a list. Something like this:
foo.py --my_list=[1, 2, 3, 4,5]
From the python optparse help page: "
parser.add_option("-f") parser.add_option("-p", type="float", nargs=3, dest="point")
As it parses the command line
-f foo.txt -p 1 -3.5 4 -fbar.txt
optparse will set
options.f = "foo.txt" options.point = (1.0, -3.5, 4.0) options.f = "bar.txt"
"