获取错误"TypeError: unsupported operand type(s) for %: 'NoneType' and 'str'"


for key in usersDict:
user = usersDict.get(key)
usersList.append(user)
if user.get_Quantity() == 0:
emptyStock = user.get_Name()
flash("%s is out of stock!!")%emptyStock
else:
continue

错误信息:

类型错误: % 不支持的操作数类型:"无类型"和"str">

对字符串使用%s有错吗?

括号在错误的位置。

闪存("%s 缺货了!!%空库存

应该是

flash("%s is out of stock!!"%emptyStock)

相关内容

最新更新