printing with print

Greg Ewing Greg.Ewing at p98.f112.n480.z2.fidonet.org
Mon Jul 5 16:53:53 EDT 1999


From: Greg Ewing <greg.ewing at compaq.com>

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