new string formatting with local variables

Ethan Furman ethan at stoneleaf.us
Mon Jun 6 17:07:46 EDT 2011


Prasad, Ramit wrote:
>> print "{} was captured by {}".format(solo, jabba)
> Is this Python2.7 specific?
> 
> Python 2.6.x : 
>>>> print "{} was captured by {}".format('t1', 't2')
> ValueError: zero length field name in format

Apparently it is 2.7 and greater -- my apologies for not specifying that.

~Ethan~



More information about the Python-list mailing list