#画彩色蟒蛇了#import turtle def drawSnake(rad,angle,len,neckrad):mycolor=["black","red","red","blue","yellow"]yocolor=["yellow","green","yellow","red","red"]for i in range(len):turtle.pencolor(mycolor[i])turtle.circle(rad,angle)#沿着一个圆形爬行#turtle.pencolor(yocolor[i])turtle.circle(-rad,angle)turtle.pencolor("green")turtle.circle(rad,angle/2)turtle.pencolor("yellow")turtle.fd(rad)turtle.pencolor("red")turtle.circle(neckrad+1,180)turtle.pencolor("green")turtle.fd(rad*2/3)def main():turtle.setup(1300,800,0,0)#启动图形窗口,宽度,高度,左上角在屏幕中的坐标位置,x,y#pythonsize = 30turtle.pensize(pythonsize)#运动轨迹的宽度,这里是30像素#turtle.seth(-40)#方向为东南方向40°#drawSnake(40,80,5,pythonsize/2)main()
格式自己整理一下。
python 是一种编程语言,python英文原意是蟒蛇的意思,说它是爬虫是不对的,但它可以做爬虫程序。爬虫是爬取互联网上的信息的一种程序。当然 python 也不只是只能爬虫程序,其他方面也是可以做的,像人工智能,大数据分析都是python 的方向。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)