Percent sign in format string?

Hans-Joachim Widmaier hjwidmaier at web.de
Fri Jul 19 03:20:38 EDT 2002


"Mark McEahern" <marklists at mceahern.com> wrote in message news:<mailman.1027039646.7875.python-list at python.org>...
> print "%d%%" % 98
> 
> in other words, % is an escape character that lets you print %.

<Nitpicking mode>

% is a format character that does not consume an argument but produces
a percent sign. This can easily be shown:


print "And I thought '%10%' was just a %s sign when in fact it's " \
      "whitespace as well!" % "percent"

</Nitpicking mode>

Hans-Joachim



More information about the Python-list mailing list