% sign in python?

Tim Roberts timr at probo.com
Fri Jul 18 08:18:07 CEST 2008

Steven Howe <howe.steven at gmail.com> wrote:

>Terry Reedy wrote:
>> korean_dave wrote:
>>> What does this operator do? Specifically in this context
>>> test.log( "[[Log level %d: %s]]" % ( level, msg ), description )
>I thought, in this contexted, it was  mapping operator.


Python does not have a "mapping operator".  It has a "map" function, but no
equivalent operator.

% is either the string formatting operator (when the left-hand operand is a
string) or the modulo operator (when the left-hand operand is a number).
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list