String formatting with the format string syntax

Benjamin Kaplan benjamin.kaplan at case.edu
Tue Sep 14 21:57:32 CEST 2010


On Tue, Sep 14, 2010 at 3:20 PM, Thomas Jollans <thomas at jollybox.de> wrote:
> On Tuesday 14 September 2010, it occurred to Miki to exclaim:
>> You can use ** syntax:
>> >>> english = {'hello':'hello'}
>> >>> s.format(**english)
>
> No, you can't. This only works with dicts, not with arbitrary mappings, or
> dict subclasses that try to do some kind of funny stuff.
>

That was changed in 2.6
http://docs.python.org/release/2.6.6/whatsnew/2.6.html#other-language-changes



More information about the Python-list mailing list