python:TypeError:%c需要int或char
…但“%c”根本不在我的脚本中python:TypeError:%c需要int或char,python,string-formatting,Python,String Formatting,…但“%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 回溯(最近一次呼叫最后一次): 文件“/build_SoS.py”,
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
回溯(最近一次呼叫最后一次):
文件“/build_SoS.py”,第88行,在
如果int(locID)=int(2501):打印“20%完成,年份为%s”%str(年)
类型错误:%c需要int或char
早些时候,我得到了“无符号字节整数大于最大值”,但不是每次,这次也不是。不知道发生了什么事
谢谢你没有“%c”,但是你有“%c”
在格式字符串中,即%
运算符的左侧,需要使用另一个%
字符转义%
字符(出现在“20%”中)
print " 20%% complete with year %s" % str(yr)
您没有“%c”,但您有“%c”
在格式字符串中,即%
运算符的左侧,需要使用另一个%
字符转义%
字符(出现在“20%”中)
print " 20%% complete with year %s" % str(yr)
或者,使用格式:打印“20%完成{1}”。格式(yr)
我想你的意思是打印“20%完成{0}”。格式(yr)
或者,使用格式:打印“20%完成{1}”。格式(yr)
我想你的意思是打印“20%完成{0}”。格式(yr)