如何克服Python中的TypeError

def myplo(data,PL):
    for name in PL:
        plt.plot(Points[0],c = Col[name],ls=":",marker= Shape[name],ms= MS[name],label = Players[0])
    plt.legend(loc='upper left',bbox_to_anchor=(1,1))
    plt.xticks(list(range(0,10)),Seasons,rotation= 'vertical')
    plt.show()
输入了

词典和所有其他相关功能。但是当我进入 myplot(点)

发生以下错误

TypeError
Traceback (most recent call last) <ipython-input-215-e2827b75a02e> in <module>()
----> 1 myplo(Points)
TypeError: myplo() missing 1 required positional argument: 'PL'
chener888 回答:如何克服Python中的TypeError

stacktrace指出出了什么问题。

当像您描述的那样以myplot(Points)调用函数时,您仅提供两个必需参数之一。 您的函数定义为def myplo(data,PL):,因此名为PL的参数不接收任何数据,这是必需的!

本文链接:https://www.f2er.com/2899604.html

大家都在问