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

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -