New Python 3.0 string formatting - really necessary?

walterbyrd walterbyrd at iname.com
Sat Dec 20 18:14:44 EST 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