New Python 3.0 string formatting - really necessary?

walterbyrd walterbyrd at iname.com
Sun Dec 21 00:14:44 CET 2008


On Dec 19, 12:43 pm, excord80 <excor... at gmail.com> wrote:

> Also, I like having only *one* special symbol (`%') to worry
> about in my strings instead of two (`{' and `}').
>

Actually the new way has, at least three special symbols: ( '{', '}' ,
'.') as well as the method name "format" so

"%s=%s" % (k, v) for k, v in params.items()

becomes:

"{0}={1}".format((k, v) for k, v in params.items())

or something like that.



More information about the Python-list mailing list