TypeError: worker() takes 0 positional arguments but 1 was given
我正在尝试实现一个子类,它抛出了错误:
1 2 3 4 5 6 7 | class KeyStatisticCollection(DataDownloadUtilities.DataDownloadCollection): def GenerateAddressStrings(self): pass def worker(): pass def DownloadProc(self): pass |
您的
如果方法不需要
1 2 3 4 5 6 7 8 9 10 11 | class KeyStatisticCollection(DataDownloadUtilities.DataDownloadCollection): def GenerateAddressStrings(self): pass @staticmethod def worker(): pass def DownloadProc(self): pass |
参见https://docs.python.org/3/library/functions.html staticmethod
您忘记将
1 2 3 4 5 6 7 | class KeyStatisticCollection(DataDownloadUtilities.DataDownloadCollection): def GenerateAddressStrings(self): pass def worker(self): pass def DownloadProc(self): pass |
号