I want to input a python list as a command line argument as for example

python weathering-sens.py -daughter ['p0-50-50','p0-0-0-100’]

but what I get from sys.argv is [p0-50-50,p0-0-0-100] without the string 
delimiters on the list elements. I’m probably missing something really simple 
because sys.argv returns strings and probably strips the string delimiters in 
that conversion … but is there any way that I can keep the string delimiters so 
that inside the code I can just go (if arg is ['p0-50-50','p0-0-0-100’])

a=eval(arg)

or is there no alternative to doing this

python weathering-sens.py -daughter 'p0-50-50’ 'p0-0-0-100’

and doing the legwork of interpreting all the arguments individually (I’ve seen 
an example of this on the web).





_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to