( binary literalsbase digits - ( +herethe octal value the hex value xffand the binary value are all decimal the digits in the hex valuefor exampleeach mean in decimal and -bit in binaryand reflect powers of thusthe hex value xff and others convert to decimal values as follows xff( ( * )( ( * )how hex/binary map to decimal ( ( ( * )( ( * )( xf ( *( ** *( ** *( ** *( ** )( python prints integer values in decimal (base by default but provides built-in functions that allow you to convert integers to other basesdigit stringsin python-literal form--useful when programs or users expect to see values in given baseoct( )hex( )bin( (' '' '' 'numbers=>digit strings the oct function converts decimal to octalhex to hexadecimaland bin to binary to go the other waythe built-in int function converts string of digits to an integerand an optional second argument lets you specify the numeric base--useful for numbers read from files as strings instead of coded in scripts ( digits=>numbers in scripts and strings int(' ')int(' ' )int(' ' )int(' ' ( int(' ' )int(' ' ( literal forms supported too the eval functionwhich you'll meet later in this booktreats strings as though they were python code thereforeit has similar effectbut usually runs more slowly--it actually compiles and runs the string as piece of programand it assumes the string being run comes from trusted source-- clever user might be able to submit string that deletes files on your machineso be careful with this calleval(' ')eval(' ')eval(' ')eval(' '( finallyyou can also convert integers to base-specific strings with string formatting method calls and expressionswhich return just digitsnot python literal strings'{ : }{ : }{ : }format( ' numbers=>digits '% % % % ( ' ffffsimilarin all pythons numeric types