Why “ValueError: zero length field name in format” error in Python on CentOS 6?

The same Python program runs without any problem while it report

ValueError: zero length field name in format

error in Python on CentOS 6

The piece of code in Python is:

print '== {} SPF'.format(d) 

Why “ValueError: zero length field name in format” error in Python on CentOS 6?

asked Sep 7 by anonymous

1 Answer

This feature of {} without the position argument specifier is only available after at least 3.1 for Python 3, or 2.7 for Python 2.

On CentOS 6, the default Python version is 2.6:

$ python --version
Python 2.6.6

So you need to add the position argument specifiers:

print '== {0} SPF'.format(d) 
answered Sep 7 by Eric Z Ma (43,420 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...