Skip to content

Instantly share code, notes, and snippets.

@abishekk92
Last active December 12, 2015 02:08
Show Gist options
  • Save abishekk92/4696428 to your computer and use it in GitHub Desktop.
Save abishekk92/4696428 to your computer and use it in GitHub Desktop.
Dynamic type casting
def cast(item):
try:
return int(item)
except:
pass
try:
return float(item)
except:
return item
_cast=map(cast,_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment