Can you escape a % in string that will used for substitution

Daniel Lenski dlenski at gmail.com
Mon Oct 22 18:59:03 CEST 2007


On Thu, 18 Oct 2007 15:21:41 -0400, Gerard Brunick wrote:
> Is there a way to do:
> 
> s = "I like python %i%s of the time." print s % (99, "%")
> 
> without having to pass in "%"?
> 
> Thanks,
> Gerard

Just double-up the % sign, e.g. "I like python %i%% of the time."




More information about the Python-list mailing list