Skip to content

Instantly share code, notes, and snippets.

@khaerulumam42
Created December 18, 2018 15:29
Show Gist options
  • Save khaerulumam42/0afecc27d3a1376d9b3ef7f88773f79c to your computer and use it in GitHub Desktop.
Save khaerulumam42/0afecc27d3a1376d9b3ef7f88773f79c to your computer and use it in GitHub Desktop.
def is_number(s):
try:
float(s)
return True
except ValueError:
pass
try:
import unicodedata
unicodedata.numeric(s)
return True
except (TypeError, ValueError):
pass
return False
def dictkeys_from_value(dictio, value):
idx_val = list(dictio.values()).index(value)
return list(dictio.keys())[idx_val]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment