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

Vinay Sajip vinay_sajip at yahoo.co.uk
Thu Oct 8 18:51:53 CEST 2009


Benjamin Peterson <benjamin <at> python.org> writes:

> It's also really easy to just write 0{:o} like my translator does.

How does that cope when handed a negative number to format?

>>> "%#0o" % -1234
'-02322'
>>> "0{0:o}".format(-1234)
'0-2322'

Regards,

Vinay Sajip





More information about the Python-Dev mailing list