> >    print "%s\t%s" % (m,menu[m][0])
> > 
> I am curious what the "%" by itself is doing.

Its a standard string formatting operation in Python.
The % operator basically says substitute the values 
in the folowing tuple for the marked fields in the 
foregoing string.

The print statement above therefore is roughly equivalent 
to:

print m + '\t' + menu[m][0]

But the formatting markers allow you to add formatting 
data like the minimum number of characters, right/left 
justification, number of digits after a decimal point, 
hex or decimal display of numbers etc etc.

Take a look in the Python docs for string formatting.

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to