[Tutor] Is there an easy way to conduct binary numbers?

Blake Winton bwinton at latte.ca
Thu Dec 23 14:36:31 CET 2004


Juan Shen wrote:
> 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?

I can't speak for everyone, but most of the people I've met who wrok
with binary learn how to read hex and translate it to binary in their
heads.  (It's slow at first, but it gets really quick with a bit of
practice.)

You could, if you needed to, write a bin function yourself.  I would
recommend calling the oct function, and replacing the characters in the
string.  (If you need help getting that working, give it a good try, and
post what you have, and I'll be happy to assist you.)

Later,
Blake.


More information about the Tutor mailing list