Duncan Booth wrote: >Jason wrote: > > > >>My first problem (lack of understanding of course) is that if I run the >>above, I get an error saying: >> >> print "%s - %s" % name,score >>TypeError: not enough arguments for format string >> >>Now I understand what it's saying, but I don't understand why. >> >> >> > >The problem is precedence. > > print "%s - %s" % name,score > >is equivalent to: > > print ("%s - %s" % name),score > >not: > > print "%s - %s" % (name,score) > >The % operator binds more tightly than the comma, so you need to put >parentheses around the argument to % (as in the last line above). > > Well said. :)
- Peter -- http://mail.python.org/mailman/listinfo/python-list