String formatting char

Skip Montanaro skip at pobox.com
Tue Nov 20 06:41:56 EST 2001


    Dale> However, the %(x)y syntax isn't appropriate if there are already
    Dale> '%' characters in the string or if, for some reason, you need to
    Dale> run the substition twice on two different mapping objects.

    Dale> You can get around it by substituting '%' for '%%' or translating
    Dale> to another char and translating back afterwards but what a pain!

    Dale> Is there some way to alter the format escape character from % to
    Dale> something else?

Not that I'm aware of.  I suspect making it changeable would be viewed with
slight disfavor.  It could lead to a bit of string obfuscation, if nothing
else.

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list