A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-October/092568.html below:

[Python-Dev] transitioning from % to {} formatting

[Python-Dev] transitioning from % to {} formatting [Python-Dev] transitioning from % to {} formattingMRAB python at mrabarnett.plus.com
Mon Oct 5 10:47:30 CEST 2009
Vinay Sajip wrote:
> Raymond Hettinger <python <at> rcn.com> writes:
>> We should get one written.  ISTM, every %-formatting
>> string is directly translatable to an equivalent {}-formatting string.
> 
> I'm not sure you can always get equivalent output from the formatting, though.
> For example:
> 
>>>> "%0#8x" % 0x1234
> '0x001234'
>>>> "{0:0>#8x}".format(0x1234)
> '000x1234'
> 
> Someone please tell me if there's a better {}-format string which I've missed!
> 
 >>> "{0:#08x}".format(0x1234)
'0x001234'
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4