[Tutor] String formatting

Jorge Louis De Castro jorge at bcs.org.uk
Sat Aug 20 16:31:40 CEST 2005


I'm slighty confused with python's string formatting operators.

Why is it that this prints as a string:

channel, info = server.accept()
print "Connection from", info

And this doesn't?

channel, info = server.accept()
print "Connection from %s" % info

Also, anyone knows how do I pass arguments to a logger?

logger.debug("Connection from:", args)

thanks and chrs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050820/f72b5060/attachment.htm

More information about the Tutor mailing list