简体   繁体   English

ValueError:长度为零的字段名称,格式为可读写

[英]ValueError: zero length field name in format with read and write

Does anybody know if it is possible to avoid the error ValueError: zero length field reading/writing from/to a file with Python 2.6.6 as specified in the following: 有人知道是否有可能避免错误ValueError: zero length field读/写,使用Python 2.6.6,如下所述:

 File "format.py", line 26, in <module>
    for row in write_cols(rows):
  File "format.py", line 19, in write_cols
    return [col_spacer.join("{:<{width}}".format(col, width=widths[index]) for index, col in enumerate(row)) for row in data]
  File "format.py", line 19, in <genexpr>
    return [col_spacer.join("{:<{width}}".format(col, width=widths[index]) for index, col in enumerate(row)) for row in data]
ValueError: zero length field name in format

Change 更改

"{:<{width}}".format(col, width=widths[index])

into 进入

"{0:<{1}}".format(col, widths[index])

Coz in older release of python, you need to point out the order of multiple format field. Coz在旧版本的python中,您需要指出多种格式字段的顺序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 valueError零长度字段名称格式 - valueError zero length field name in format ValueError:格式为零长度字段名称 - ValueError: zero length field name in format ValueError:Python2.6.6格式的零长度字段名称 - ValueError: zero length field name in format in Python2.6.6 将数据导出到文本文件中,并且ValueError:格式为零长度的字段名称 - export data into a text file and ValueError: zero length field name in format Django manage.py返回ValueError:格式为零长度的字段名称 - Django manage.py returns ValueError: zero length field name in format Python 3.0、3.1、3.2中的“ ValueError:格式为零长度的字段名称”错误 - “ValueError: zero length field name in format” error in Python 3.0,3.1,3.2 在运行pypi-server时获取ValueError:格式为零长度的字段名称 - While running pypi-server getting ValueError: zero length field name in format Python - 格式的零长度字段名称 - Python - Zero length field name in format l_dumpid = str(&#39;{:08x}&#39;。format(l_dumpid))ValueError:零长度字段格式 - l_dumpid = str('{:08x}'.format(l_dumpid)) ValueError: zero length field name in format Python,获取 ValueError:在使用正则表达式的字符串中的格式变量时,字段名称中出现意外的“{” - Python, getting ValueError: unexpected '{' in field name when using format variable in a string with regex
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM