converting decimal to binary
Michael P. Soulier
msoulier at storm.ca._nospam
Fri May 23 20:02:14 EDT 2003
Hey people.
I'm trying to find a simple way to convert a decimal number to a
binary string representation. I could do this the hard way, but as it's
a one-liner in perl, I'm hoping there's an easy way to do this in
python.
main::(-e:1): 0
DB<1> p unpack("B*", pack("C", 192))
11000000
Is there a similar way to do this in Python?
Thanks,
Mike
--
Michael P. Soulier <msoulier at digitaltorque.ca>, GnuPG pub key: 5BC8BE08
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort." -Harley Hahn, A Student's Guide to Unix
HTML Email Considered Harmful: http://expita.com/nomime.html
More information about the Python-list
mailing list