Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84011

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

From Peter Otten <__peter__@web.de>
Subject Re: How to change the number into the same expression's string and vice versa?
Date 2015-01-19 12:46 +0100
Organization None
References <CA+YdQ_651X0NDPw1j203WGbeDTxy_Mw7g0w3VH1WoaGR1iv-Cg@mail.gmail.com> <mailman.17846.1421659473.18130.python-list@python.org> <qot8ugzqfgt.fsf@ruuvi.it.helsinki.fi>
Newsgroups comp.lang.python
Message-ID <mailman.17850.1421668007.18130.python-list@python.org> (permalink)

Show all headers | View raw


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!

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: How to change the number into the same expression's string and vice versa? Peter Otten <__peter__@web.de> - 2015-01-19 10:24 +0100
  Re: How to change the number into the same expression's string and vice versa? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-19 11:36 +0200
    Re: How to change the number into the same expression's string and vice versa? Peter Otten <__peter__@web.de> - 2015-01-19 12:46 +0100

csiph-web