python vs ecmascript

Yong Lu lyongu at ailab.pku.edu.cn
Tue Nov 27 10:21:30 EST 2001


David Bolen <db3l at fitlinxx.com> writes:

> 
> One other useful mention is that the "%s" formatter is Python string
> formatting operations will automatically apply str() to any non-string
> object that it is handed.  So another approach could be:
> 
>     print "integer i = %s" % i
>

A newbie question.  Where can I find documentation of this usage?
I've searched a bit in the Python manual, but the only section
on print doesn't mention this.

> and in this approach you have complete control over spacing and what
> not since it's all internal to the format string.  Note that
> technically the argument to % is a tuple, but for a single argument it
> works singly, so you don't have to bother writing (i,).
> 
> --
> -- David
> -- 
> /-----------------------------------------------------------------------\
>  \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
>   |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
>  /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
> \-----------------------------------------------------------------------/


Regards,

Yong



More information about the Python-list mailing list