The same Python program runs without any problem while it report
报告相同的Python程序时没有任何问题
ValueError: zero length field name in format
error in Python on CentOS 6
CentOS 6上Python中的错误
The piece of code in Python is:
Python中的代码片段是:
print '== {} SPF'.format(d)
Why “ValueError: zero length field name in format” error in Python on CentOS 6?
为什么在CentOS 6上的Python中出现“ ValueError:格式为零长度的字段名称”错误?
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.
没有位置参数说明符的{}
此功能仅在Python 3至少为3.1或Python 2至少为2.7之后可用。
On CentOS 6, the default Python version is 2.6:
在CentOS 6上,默认的Python版本是2.6:
$ python --version
Python 2.6.6
So you need to add the position argument specifiers:
因此,您需要添加position参数说明符:
print '== {0} SPF'.format(d)