Input is
["('ABCD','ABCD.pdf',10)", "('ABCD','ABCD.pdf',14)", "('ABCD','ABCD.pdf',15)"]
Expected output
[('ABCD','ABCD.pdf',10),('ABCD','ABCD.pdf',14), ('ABCD','ABCD.pdf',15)]
CodePudding user response:
One quick solution is to use eval
and map
.
Example:
text = ["('ABCD','ABCD.pdf',10)", "('ABCD','ABCD.pdf',14)", "('ABCD','ABCD.pdf',15)"]
out = list(map(eval, text))
Out contains the desired result.
See the python docs here