AttributeError:“list”对象没有属性“f1index”

2024-10-02 00:28:18 发布

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

我从这段代码中得到一个错误。在

fighter1, fighter2 = random.sample(players, 2)
f1index = (players).index(fighter1)
f2index = (players).index(fighter2)
# ^ finds both fighters index in list
f1strength = strengths.f1index
f2strength = strengths.f2index
# ^ finds fighters strength attributes

这是我得到的错误。在

^{pr2}$

Tags: sample代码inindex错误randomfindsplayers

热门问题