I want to convert a list of string representations of tuples, such as:
["(279, 256000, '.m4a')", "(217, 256000, '.m4a')", "(174, 128000, '.mp3')"]
into a list of tuples, such as:
[(279, 256000, '.m4a'), (217, 256000, '.m4a'), (174, 128000, '.mp3')]
This seems to be the most concise (and clear) way to do it
recs = ... # loaded from text file
data = map(eval, recs)
However, Ive seen a posting Python course - lambda that seems to imply map() may not be good python or may become deprecated.
The alternative would seem to be something like the more verbose (and hence slightly less clear):
data = []
for r in recs:
data += [eval(r)]
Which is more pythonic?