Googling in comp.lang.python for "convert binary" gives several solutions including the ones in this thread: http://tinyurl.com/6dwom
Juan Shen wrote: > I have found there are easy functions and options to do basic octal and > hexadecimal number operation. > > oct(...) > oct(number) -> string > > Return the octal representation of an integer or long integer. > > hex(...) > hex(number) -> string > > Return the hexadecimal representation of an integer or long integer. > > print '%o' %number > Print a decimal number in octal format. > > print '%X' %number > Print a decimal number in hexadecimal format. > > However, I can't find their binary counterpart, something like bin(...) > or print '%b'. Binary integer is extremely useful in my > electronic-related job. So...I need help. Is there any function to > transform between binary and decimal integers in python's library? If > not, what's the solution to binary? > Juan > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor