How to change the number into the same expression's string and vice versa?

Peter Otten __peter__ at web.de
Mon Jan 19 06:46:33 EST 2015


Jussi Piitulainen wrote:
> Peter Otten writes:

>> >>> "{:o}".format(0xf4)
>> '364'

>> To add a prefix just put it into the format string.
 
> There's also these (in Python 3.2.3):
>> >>> hex(0xf4)
> '0xf4'

D'oh!


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /