I have a list say:
[\'batting average\', \'306\', \'ERA\', \'1710\']
How can I convert the intended numbers without touching the strings?>
Try this:
def convert( someList ): for item in someList: try: yield int(item) except ValueError: yield item newList= list( convert( oldList ) )