Created
December 4, 2018 16:02
-
-
Save iamucil/5b9aa3f150ca36d0d35cc95de5efab2e to your computer and use it in GitHub Desktop.
python string conversion, string to int and vice versa
This file contains 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
inp = input("Identifier: ") | |
try: | |
val = int(inp) | |
print('%x' % val) | |
except ValueError: | |
print(int(inp, 16)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment