'list' object cannot be interpreted as an integer这个问题怎么解决?

#AutoTraceDraw.py

import turtle as t
t.title(“自动绘制轨迹”)
t.setup(800, 600, 0, 0)
t.pencolor(“red”)
t.pensize(5)

数据读取

datals= []
f = open(“data.txt”)
for line in f:
line = line.replace("\n", “”) # 换行符变化为空字符信息
datals.append(list(map(eval, line.split(","))))
f.close()

自动绘制

for i in range(datals):
t.pencolor(datals[i][3],datals[i][4],datals[i][5]) #获取rgb值
f.fd(datals[i][0])
if datals[i][1]:
t.right(datals[i][2])
else:
t.left(datals[i][2])

报错出现在for i in range(datals):
报错为’list’ object cannot be interpreted as an integer 这怎么解决?

你可能感兴趣的:('list' object cannot be interpreted as an integer这个问题怎么解决?)