printing with print

Greg Ewing greg.ewing at compaq.com
Sun Jul 4 16:53:53 EDT 1999


Angus MacKay wrote:
> 
> I like the printing of any object ability of "print" so I
> do not want to use "" % style printing

The "%s" format will handle any object, too -
not just strings:

>>> x = [1, 2]
>>> y = ("buckle", ("my", "shoe"))
>>> print "%s%s" % (x, y)
[1, 2]('buckle', ('my', 'shoe'))

Look, ma, no space!

Greg




More information about the Python-list mailing list