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

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -