【发布时间】:2017-03-31 04:44:48
【问题描述】:
我想问一下 Python 中的 turtle 库。
我有一个CSV 文件,其中包含一千多个十进制形式的 x 和 y 坐标。
我一直试图从中划出界限。如果有人在这方面指导我会更好。
x,y
74.741996766068,37.0220565806516
74.7491989145055,37.0214805616257
74.7692108154297,37.0256614702854
74.7718505859375,37.0269050617947
74.7776947040111,37.0296592720303
74.7827606210485,37.0320396441619
所以我在下面写了这段代码,但它对我没有用。
import turtle
import csv
import sys
def main():
daniel = turtle.Turtle() #Set up a turtle named "daniel"
myWin = turtle.Screen() #The graphics window
t = open('CSV.csv')
#Draw a square
for i in t:
daniel.forward(t[1]) #Move forward 10 steps
daniel.right(t[0]) #Turn 90 degrees to the right
myWin.exitonclick() #Close the window when clicked
main()
【问题讨论】:
标签: python csv turtle-graphics