convert string to list

Jochen Hub jhub at gwdg.here_simple_one_dot.de
Wed Oct 13 08:03:26 EDT 2004


Hi,

I am a real beginner in Python and I was wondering if there is a way to 
convert a string (which contains a list) to a "real" list.

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"]

Thanks you,
Jochen



More information about the Python-list mailing list