MRAB <python <at> mrabarnett.plus.com> writes:
> >>> "{0:#08x}".format(0x1234)
> '0x001234'
Good call, but here's another case:
>>> "%#o" % 0x1234
'011064'
I don't see how to automatically convert the "%#o" spec, though of course there
are ways of fudging it. The obvious conversion doesn't give the same value:
>>> "{0:#o}".format(0x1234)
'0o11064'
I couldn't see a backward-compatibility mode for str.format generating just a
leading "0" for octal alternative format (the C style) as opposed to "0o".
Regards,
Vinay Sajip
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com