convert string to list
Diez B. Roggisch
deetsNOSPAM at web.de
Wed Oct 13 08:08:05 EDT 2004
Jochen Hub wrote:
>
> I need this since I would like to give a list as an argument to my
> Python script from the bash:
>
> #!/usr/bin/python
> import sys
> argument1 = sys.argv[1]
> thelist = ???(argument1)
>
> and then call the script from the bash like this
>
> thescript.py ["A","B","C"]
Why don't you give the args standalone
thescript.py "A" "B" "C"
and do this:
thelist = sys.argv[1:]
--
Regards,
Diez B. Roggisch
More information about the Python-list
mailing list