For example, I have a list a = ['3*4', '2*3', '4*6']
,
I want to print the string in the list whose result will be the largest, '4*6' in this case.
>>> a = ['3*4', '2*3', '4*6']
>>> max(a, key=eval)
'4*6'
with the usual caveats about using eval of course