python - Turning string inside string into "normal" string -
i have routine gives me list looks :
["'foo'", "'bar'", "'tmp'", "'tmp2'" …]
how can turn these into:
['foo', 'bar', 'tmp', 'tmp2']
in python 2.7?
new_list = [x[1:-1] x in old_list]
a simple list comprehension recreate list without first , last character should trick.
Comments
Post a Comment