【发布时间】:2016-11-30 20:13:41
【问题描述】:
在我的 python 程序中,我正在读取文件并将内容存储在列表中。我检查了列表的每个索引,所以我知道它存储正确。
然后我将一个特定的索引传递给一个包含蓝色的类。
每当它到达turtle.color我得到一个错误bad color string: "blue"
例如:
Team = Rainbow(str(sequence[0]),str(sequence[1]), str(sequence[2])) //index 2 (str(sequence[2])) contains "blue"
我有一堂课
class Rainbow:
def __init__(self, Rname, Rteam, Rcolor):
self.name = Rname
self.team = Rteam
self.color = Rcolor
self.Rturtle = turtle.Turtle()
self.Rturtle.color(self.color)//here is where I get the error
我确保所有内容都正确导入,并对这个错误进行了一些研究,只遇到了错误序列的问题。另外,如果我通过Team = Rainbow("Jay","Blue Jays","blue")我不会得到错误。
我想知道是否有人可以提供帮助
【问题讨论】:
标签: python python-3.x colors turtle-graphics