为什么在CentOS 6上的Python中出现“ ValueError:格式为零长度的字段名称”错误?...

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)
Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。

翻译自: https://www.systutorials.com/why-valueerror-zero-length-field-name-in-format-error-in-python-on-centos-6/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值