Created
February 13, 2013 19:19
-
-
Save mdogo/4947278 to your computer and use it in GitHub Desktop.
Dynamic casting of basic types on Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getattr(__builtin__, type_of)(value) | |
# Where type_of is a string with the casting type and value the value to cast |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment