Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove double quotes from the nested list in python

Tags:

python

list

I have small nested list like this ["['95', '66', '137', '70', '20']"]. I want to remove " for my nested list. How to do this?

like image 826
acoustic python Avatar asked Mar 10 '26 21:03

acoustic python


1 Answers

import ast 
mystr = ["['95', '66', '137', '70', '20']"]
print(ast.literal_eval(mystr[0]))
like image 152
sam Avatar answered Mar 13 '26 11:03

sam