Uoti Urpala added the comment:
This kind of formatting is needed quite often when working on network protocols
or file formats, and I think the replies here fail to address important issues.
In general you can't encode after formatting, as that doesn't work with binary
data, and
Uoti Urpala added the comment:
I've hit this limitation a couple more times, and none of the proposed
workarounds are adequate. Working with protocols and file formats that use
human-readable markup is significantly clumsier than it was with Python 2
(using either the % operator, which