Re: Can string formatting be used to convert an integer to its binary form ?
- From: bearophileHUGS@xxxxxxxxx
- Date: 28 Sep 2006 08:00:15 -0700
Mirco Wahab:
But where is the %b in Python?
Python doesn't have that. You can convert the number to a hex, and then
map the hex digitds to binary strings using a dictionary, like this:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440528
Bye,
bearophile
.
- Follow-Ups:
- Re: Can string formatting be used to convert an integer to its binary form ?
- From: Frederic Rentsch
- Re: Can string formatting be used to convert an integer to its binary form ?
- References:
- Can string formatting be used to convert an integer to its binary form ?
- From: fdu.xiaojf@xxxxxxxxx
- Re: Can string formatting be used to convert an integer to its binary form ?
- From: Mirco Wahab
- Re: Can string formatting be used to convert an integer to its binary form ?
- From: Gabriel Genellina
- Re: Can string formatting be used to convert an integer to its binary form ?
- From: Mirco Wahab
- Can string formatting be used to convert an integer to its binary form ?
- Prev by Date: Re: XSLT speed comparisons
- Next by Date: Re: How to update my web automatically by python?
- Previous by thread: Re: Can string formatting be used to convert an integer to its binary form ?
- Next by thread: Re: Can string formatting be used to convert an integer to its binary form ?
- Index(es):
Relevant Pages
|