Str.format () für Python 2.6 gibt einen Fehler aus, 2.7 nicht

Ich habe einen Code, der in Python 2.7 gut funktioniert.

Python 2.7.3 (default, Jan  2 2013, 13:56:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import stdout
>>> foo = 'Bar'
>>> numb = 10
>>> stdout.write('{} {}\n'.format(numb, foo))
10 Bar
>>>

Aber in 2.6 bekomme ich eine ValueError-Ausnahme.

Python 2.6.8 (unknown, Jan 26 2013, 14:35:25) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sys import stdout
>>> foo = 'Bar'
>>> numb = 10
>>> stdout.write('{} {}\n'.format(numb, foo))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: zero length field name in format
>>>

Beim Durchsehen der Dokumentation (2.6, 2.7) Kann ich keine Erwähnung von Änderungen zwischen den beiden Versionen sehen. Was passiert hier?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage