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

Tim Chase python.list at tim.thechases.com
Thu Oct 18 16:09:11 EDT 2007


> Is there a way to do:
> 
> s = "I like python %i%s of the time."
> print s % (99, "%")
> 
> without having to pass in "%"?

You mean like

  s = "I like python %i%% of the time."
  print s % 99

http://docs.python.org/lib/typesseq-strings.html

-tkc







More information about the Python-list mailing list