noneType和str是不支持的操作数类型。导致这个TypeError的原因是什么?

2024-06-23 18:31:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我得到以下错误:TypeError:不支持+:“NoneType”和“str”的操作数类型

    return summary + "They work on the " + ProductionWorker.SHIFT[self.__shift] + " and make " + "$" \
           + str(format(self.__hourly_pay, "0.2f")) + " an hour."

Tags: theself类型returnshifton错误summary
2条回答

这意味着其中一个变量是None,它不能添加到str中。在

摘要或生产工人.SHIFT[self.\uu shift]不是,但是在不了解其他代码的情况下很难判断。 添加

print(summary,ProductionWorker.SHIFT[self.__shift])

回来之前看看是什么。在

相关问题 更多 >

    热门问题