Created
September 22, 2019 05:13
-
-
Save goyalrohit/cf3d3d6b57fafde918afa7c86189d5c1 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
# hexadecimal value | |
number1 = '32' | |
# decimal value during conversion | |
print(int(number1)) | |
# considering as hexadecimal value during conversion | |
print(int(number1, base=16)) | |
# another hexadecimal value that contains string value | |
number2 = '2e' | |
# considering as hexadecimal value during conversion | |
print(int(number2, base=16)) | |
# raises an exception during conversion | |
print(int(number2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment