Don Parris said unto the world upon 20/06/2005 14:10: > On Mon, 20 Jun 2005 09:11:53 +0100 > "Alan G" <[EMAIL PROTECTED]> wrote:
<snip> >>for m in menu.keys(): >> print "%s\t%s" % (m,menu[m][0]) >> > > I am curious what the "%" by itself is doing. <snip> > Don Hi Don, it is indicating that the tuple that follows is the source that the values for the '%s's in "%s\t%s" will be drawn from. I generally write it without the space between the '%' and the tuple; I don't know what the general practise is. >>> print "%s won't %s" ('this', 'work') Traceback (most recent call last): File "<interactive input>", line 1, in ? TypeError: 'str' object is not callable >>> print "%s will %s" %('this', 'work') this will work >>> print "%s will %s" % ('this', 'work, too') this will work, too >>> Best, Brian vdB _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor