Skip to content

Instantly share code, notes, and snippets.

@brannn
Created September 29, 2014 15:35
Show Gist options
  • Select an option

  • Save brannn/5eba6180e1d6ae772ebe to your computer and use it in GitHub Desktop.

Select an option

Save brannn/5eba6180e1d6ae772ebe to your computer and use it in GitHub Desktop.
convert single dict value to int
#python2.7
{k:int(v) if v.isdigit() else v for k,v in DATABASE.iteritems()}
#python3
k:int(v) if v.isdigit() else v for k,v in DATABASE.items()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment