convert a number from other base to integer
I have been using the int() function for converting string representation of a number to it's numeric value. For example: number = int('1050') But today I just come to know that there is an optional second argument in the int function. It will help you convert any number from base 2 to 36 into base 10. Few examples are given below: >>> int('xyz', 36) 44027 >>> int('ff', 16) 255 >>> int('FF', 16) 255 >>> int('f', 16) 15 >>> int('10', 2) 2 >>> int('10') 10 >>> int('10', 10) 10 Python is simple!