Take 3 - multiple arguments to str()

Skip Montanaro skip at pobox.com
Sun Dec 23 16:04:01 CET 2001


    Oren> The multiple argument version of str may be used to defeat the
    Oren> print statement's automatic spacing and for general formatting of
    Oren> strings with embedded expressions.

    Oren>   print str("X=",x," Y=",calc_y(x))

Why bother?  Print is a convenience.  If you need precise control you can
either use %-formatted strings or the file object's write method.

Seems unnecessary to me.

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list