Skip to content

Instantly share code, notes, and snippets.

@Zagrebelin
Created November 3, 2017 06:47
Show Gist options
  • Save Zagrebelin/6fcb9186b84c1cdcfaf149682abeb9a2 to your computer and use it in GitHub Desktop.
Save Zagrebelin/6fcb9186b84c1cdcfaf149682abeb9a2 to your computer and use it in GitHub Desktop.
def transform(value):
return {'True':True, 'False':False}.get(value, value)
d = {'str1': 'True','str2':'string','str3':10}
d2 = {key:transform(value) for key, value in d.items()}
assert d2 == {'str1': True,'str2':'string','str3':10}
print('OK')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment