Very stupid question about a % symbol

Terry Reedy tjreedy at udel.edu
Thu Sep 16 22:48:21 EDT 2010


On 9/16/2010 12:23 PM, J wrote:
> Thanks for the replies... I KNEW there was a simple way to escape the
> % but I had no idea what it was (I just had conviction).
>> I was thrown when the \ didn't escape it... never knew about %%. But
> now I do! Thanks for the replies!

Doubling an escape char, whatever it is, is a common convention:
 >>> print("Print a {{}} format string line this: {{{}}}".format(2))
Print a {} format string line this: {2}
-- 
Terry Jan Reedy


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /