ESPN播放器免费
class ESPNPlayerFree:
def __init__(self, player_id, match_id, match_id_team):
...
团队名单1:
[('277906', 'cA2i150s81HI3qbq1fzi', 'za1Oq5CGHj3pkkXWNghG'), ('213674', 'cA2i150s81HI3qbq1fzi', 'za1Oq5CGHj3pkkXWNghG')]
Code
with concurrent.futures.ProcessPoolExecutor(max_workers=30) as executor:
results = list(executor.map(ESPNPlayerFree, teamList1))
类型错误:__init__() missing 2 required positional arguments: 'match_id' and 'match_id_team'
Since starmap
不可用,为此创建一个辅助工厂函数:
def player_helper(args):
return ESPNPlayerFree(*args)
with concurrent.futures.ProcessPoolExecutor(max_workers=30) as executor:
results = list(executor.map(player_helper, teamList1))
或者将其制作成classmethod
上课ESPNPlayerFree
如果它更有意义:
class ESPNPlayerFree:
...
@classmethod
def expand_args(cls, args):
return cls(*args)
with concurrent.futures.ProcessPoolExecutor(max_workers=30) as executor:
results = list(executor.map(ESPNPlayerFree.expand_args, teamList1))
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)