Last active
September 22, 2019 03:10
-
-
Save goyalrohit/79afd4b923c6a6c4536906b637f891a4 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 | |
#Assign string value to the variable | |
myText = '2019' | |
print(type(myText)) | |
#convert String to Integer | |
intValue = int(myText) | |
#integer value | |
print(intValue) | |
#type of the converted value | |
print(type(intValue)) | |
#convert String to Integer base 12 | |
intValue12 = int(myText, base=12) | |
#integer value | |
print(intValue12) | |
#type of the converted value | |
print(type(intValue12)) | |
#convert String to Integer base 16 | |
intValue16 = int(myText, base=16) | |
#integer value | |
print(intValue16) | |
#type of the converted value | |
print(type(intValue16)) | |
#convert String to Integer base 24 | |
intValue24 = int(myText, base=24) | |
#integer value | |
print(intValue24) | |
#type of the converted value | |
print(type(intValue24)) | |
#convert String to Integer base 32 | |
intValue32 = int(myText, base=32) | |
#integer value | |
print(intValue32) | |
#type of the converted value | |
print(type(intValue32)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment