python ValueError: cannot switch from automatic field numbering to manual field specification

来源:互联网 发布:gsm是什么卡的网络 编辑:程序博客网 时间:2024/06/01 07:48

ValueError: cannot switch from automatic field numbering to manual field specification


此问题是format()函数 前面大括号里 没写 数字 对应后面的 ()的顺序的值


tplt="{:^10}\t{:{3}^8}\t{:^10}"    print(tplt.format("排名","学校","总分",chr(12288)))

错误


tplt="{0:^10}\t{1:{3}^8}\t{2:^10}"    print(tplt.format("排名","学校","总分",chr(12288)))

正确

阅读全文
0 0
原创粉丝点击