W
Wes James
I have been trying to create a list form a string. The string will be
a list (this is the contents will look like a list). i.e. "[]" or
"['a','b']"
The "[]" is simple since I can just check if value == "[]" then return []
But with "['a','b']" I have tried and get:
a="['a','b']"
b=a[1:-1].split(',')
returns
[ " 'a' "," 'b' " ]
when I want it to return ['a','b'].
How can I do this?
thx,
-wes
a list (this is the contents will look like a list). i.e. "[]" or
"['a','b']"
The "[]" is simple since I can just check if value == "[]" then return []
But with "['a','b']" I have tried and get:
a="['a','b']"
b=a[1:-1].split(',')
returns
[ " 'a' "," 'b' " ]
when I want it to return ['a','b'].
How can I do this?
thx,
-wes