> How can I do it with several variables?
> I = "John"
> print "%s used to love pizza" % I

wrap them in parens:

>>> a,b = 3,4
>>> print "%d x %d = %d" % (a,b, a*b)

> About 10 or more...

Same technique but you might find it easier to use labels to 
identify the fields.

>>> sum = a+b
>>> print "%(a)d + %(b)d = %(sum)d" % locals()

My tutoroial covers some of this in the Simple Sequences topic.

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld

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

Reply via email to