...但是“%c”根本不在我的脚本中。
Traceback (most recent call last):
File "./build_SoS.py", line 88, in <module>
if int(locID) == int(2501): print " 20% complete with year %s" % str(yr)
TypeError: %c requires int or char
早些时候,我得到了“无符号字节整数大于最大值”,但不是每次都这样,而且不是这次。不知道发生了什么。
谢谢
您没有“%c”,但是您有“%c”。
在格式字符串(即%
运算符的左侧)内,您需要%
使用另一个%
字符对字符(出现在“ 20%”中)进行转义。
print " 20%% complete with year %s" % str(yr)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句