Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔

原创

Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_43943977/article/details/102691392

最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成喔~)
one 樱花树

  • 动态生成樱花
    效果图(这个是动态的):
    在这里插入图片描述实现代码
import turtle as T
import random
import time

# 画樱花的躯干(60,t)
def Tree(branch, t):
time.sleep(0.0005)
if branch > 3:
if 8 <= branch <= 12:
if random.randint(0, 2) 0:
t.color(‘snow’) # 白
else:
t.color(‘lightcoral’) # 淡珊瑚色
t.pensize(branch / 3)
elif branch < 8:
if random.randint(0, 1) 0:
t.color(‘snow’)
else:
t.color(‘lightcoral’) # 淡珊瑚色
t.pensize(branch / 2)
else:
t.color(‘sienna’) # 赭(zhě)色
t.pensize(branch / 10) # 6
t.forward(branch)
a = 1.5 random.random()
t.right(20 a)
b = 1.5 random.random()
Tree(branch - 10 b, t)
t.left(40 a)
Tree(branch - 10 b, t)
t.right(20 * a)
t.up()
t.backward(branch)
t.down()

# 掉落的花瓣
def Petal(m, t):
for i in range(m):
a = 200 - 400 random.random()
b = 10 - 20 random.random()
t.up()
t.forward(b)
t.left(90)
t.forward(a)
t.down()
t.color(‘lightcoral’) # 淡珊瑚色
t.circle(1)
t.up()
t.backward(a)
t.right(90)
t.backward(b)

# 绘图区域
t = T.Turtle()
# 画布大小
w = T.Screen()
t.hideturtle() # 隐藏画笔
t.getscreen().tracer(5, 0)
w.screensize(bg=‘wheat’) # wheat小麦
t.left(90)
t.up()
t.backward(150)
t.down()
t.color(‘sienna’)

# 画樱花的躯干
Tree(60, t)
# 掉落的花瓣
Petal(200, t)
w.exitonclick()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 飘落效果
    效果图:
    在这里插入图片描述代码:
from turtle import *
from random import *
from math import *

def tree(n,l):
pd()#下笔
#阴影效果
t = cos(radians(heading()+45))/8+0.25
pencolor(t,t,t)
pensize(n/3)
forward(l)#画树枝

<span class="token keyword">if</span> n<span class="token operator">&gt;</span><span class="token number">0</span><span class="token punctuation">:</span>
    b <span class="token operator">=</span> random<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token number">15</span><span class="token operator">+</span><span class="token number">10</span> <span class="token comment">#右分支偏转角度</span>
    c <span class="token operator">=</span> random<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token number">15</span><span class="token operator">+</span><span class="token number">10</span> <span class="token comment">#左分支偏转角度</span>
    d <span class="token operator">=</span> l<span class="token operator">*</span><span class="token punctuation">(</span>random<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token number">0.25</span><span class="token operator">+</span><span class="token number">0.7</span><span class="token punctuation">)</span> <span class="token comment">#下一个分支的长度</span>
    <span class="token comment">#右转一定角度,画右分支</span>
    right<span class="token punctuation">(</span>b<span class="token punctuation">)</span>
    tree<span class="token punctuation">(</span>n<span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">,</span>d<span class="token punctuation">)</span>
    <span class="token comment">#左转一定角度,画左分支</span>
    left<span class="token punctuation">(</span>b<span class="token operator">+</span>c<span class="token punctuation">)</span>
    tree<span class="token punctuation">(</span>n<span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">,</span>d<span class="token punctuation">)</span>
    <span class="token comment">#转回来</span>
    right<span class="token punctuation">(</span>c<span class="token punctuation">)</span>
<span class="token keyword">else</span><span class="token punctuation">:</span>
    <span class="token comment">#画叶子</span>
    right<span class="token punctuation">(</span><span class="token number">90</span><span class="token punctuation">)</span>
    n<span class="token operator">=</span>cos<span class="token punctuation">(</span>radians<span class="token punctuation">(</span>heading<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-</span><span class="token number">45</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token operator">/</span><span class="token number">4</span><span class="token operator">+</span><span class="token number">0.5</span>
    pencolor<span class="token punctuation">(</span>n<span class="token punctuation">,</span>n<span class="token operator">*</span><span class="token number">0.8</span><span class="token punctuation">,</span>n<span class="token operator">*</span><span class="token number">0.8</span><span class="token punctuation">)</span>
    circle<span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span>
    left<span class="token punctuation">(</span><span class="token number">90</span><span class="token punctuation">)</span>
    <span class="token comment">#添加0.3倍的飘落叶子</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>random<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">&gt;</span><span class="token number">0.7</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
        pu<span class="token punctuation">(</span><span class="token punctuation">)</span>
        <span class="token comment">#飘落</span>
        t <span class="token operator">=</span> heading<span class="token punctuation">(</span><span class="token punctuation">)</span>
        an <span class="token operator">=</span> <span class="token operator">-</span><span class="token number">40</span> <span class="token operator">+</span>random<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token number">40</span>
        setheading<span class="token punctuation">(</span>an<span class="token punctuation">)</span>
        dis <span class="token operator">=</span> <span class="token builtin">int</span><span class="token punctuation">(</span><span class="token number">800</span><span class="token operator">*</span>random<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token number">0.5</span> <span class="token operator">+</span> <span class="token number">400</span><span class="token operator">*</span>random<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token number">0.3</span> <span class="token operator">+</span> <span class="token number">200</span><span class="token operator">*</span>random<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">*</span><span class="token number">0.2</span><span class="token punctuation">)</span>
        forward<span class="token punctuation">(</span>dis<span class="token punctuation">)</span>
        setheading<span class="token punctuation">(</span>t<span class="token punctuation">)</span>
        <span class="token comment">#画叶子</span>
        pd<span class="token punctuation">(</span><span class="token punctuation">)</span>
        right<span class="token punctuation">(</span><span class="token number">90</span><span class="token punctuation">)</span>
        n <span class="token operator">=</span> cos<span class="token punctuation">(</span>radians<span class="token punctuation">(</span>heading<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-</span><span class="token number">45</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token operator">/</span><span class="token number">4</span><span class="token operator">+</span><span class="token number">0.5</span>
        pencolor<span class="token punctuation">(</span>n<span class="token operator">*</span><span class="token number">0.5</span><span class="token operator">+</span><span class="token number">0.5</span><span class="token punctuation">,</span><span class="token number">0.4</span><span class="token operator">+</span>n<span class="token operator">*</span><span class="token number">0.4</span><span class="token punctuation">,</span><span class="token number">0.4</span><span class="token operator">+</span>n<span class="token operator">*</span><span class="token number">0.4</span><span class="token punctuation">)</span>
        circle<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span>
        left<span class="token punctuation">(</span><span class="token number">90</span><span class="token punctuation">)</span>
        pu<span class="token punctuation">(</span><span class="token punctuation">)</span>
        <span class="token comment">#返回</span>
        t<span class="token operator">=</span>heading<span class="token punctuation">(</span><span class="token punctuation">)</span>
        setheading<span class="token punctuation">(</span>an<span class="token punctuation">)</span>
        backward<span class="token punctuation">(</span>dis<span class="token punctuation">)</span>
        setheading<span class="token punctuation">(</span>t<span class="token punctuation">)</span>
pu<span class="token punctuation">(</span><span class="token punctuation">)</span>
backward<span class="token punctuation">(</span>l<span class="token punctuation">)</span><span class="token comment">#退回</span>

bgcolor(0.5,0.5,0.5)#背景色
ht()#隐藏turtle
speed(0)#速度 1-10渐进,0 最快
tracer(0,0)
pu()#抬笔
backward(100)
left(90)#左转90度
pu()#抬笔
backward(300)#后退300
tree(12,100)#递归7层
done()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 暗色效果
    效果:
    在这里插入图片描述
    代码
from turtle import *
from random import *
from math import *

def tree(n, l):
pd()
t = cos(radians(heading() + 45)) / 8 + 0.25
pencolor(t, t, t)
pensize(n / 4)
forward(l)
if n > 0:
b = random() 15 + 10
c = random() 15 + 10
d = l (random() 0.35 + 0.6)
right(b)
tree(n - 1, d)
left(b + c)
tree(n - 1, d)
right(c)
else:
right(90)
n = cos(radians(heading() - 45)) / 4 + 0.5
pencolor(n, n, n)
circle(2)
left(90)
pu()
backward(l)
bgcolor(0.5, 0.5, 0.5)
ht()
speed(0)
tracer(0, 0)
left(90)
pu()
backward(300)
tree(13, 100)
done()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

two 玫瑰花
效果(有绘制过程)
在这里插入图片描述代码


from turtle import *
import time

setup(1000,800,0,0)
speed(0)
penup()
seth(90)
fd(340)
seth(0)
pendown()

speed(5)
begin_fill()
fillcolor(‘red’)
circle(50,30)

for i in range(10):
fd(1)
left(10)

circle(40,40)

for i in range(6):
fd(1)
left(3)

circle(80,40)

for i in range(20):
fd(0.5)
left(5)

circle(80,45)

for i in range(10):
fd(2)
left(1)

circle(80,25)

for i in range(20):
fd(1)
left(4)

circle(50,50)

time.sleep(0.1)

circle(120,55)

speed(0)

seth(-90)
fd(70)

right(150)
fd(20)

left(140)
circle(140,90)

left(30)
circle(160,100)

left(130)
fd(25)

penup()
right(150)
circle(40,80)
pendown()

left(115)
fd(60)

penup()
left(180)
fd(60)
pendown()

end_fill()

right(120)
circle(-50,50)
circle(-20,90)

speed(1)
fd(75)

speed(0)
circle(90,110)

penup()
left(162)
fd(185)
left(170)
pendown()
circle(200,10)
circle(100,40)
circle(-52,115)
left(20)
circle(100,20)
circle(300,20)
speed(1)
fd(250)

penup()
speed(0)
left(180)
fd(250)
circle(-300,7)
right(80)
circle(200,5)
pendown()

left(60)
begin_fill()
fillcolor(‘green’)
circle(-80,100)
right(90)
fd(10)
left(20)
circle(-63,127)
end_fill()

penup()
left(50)
fd(20)
left(180)

pendown()
circle(200,25)

penup()
right(150)

fd(180)

right(40)
pendown()
begin_fill()
fillcolor(‘green’)
circle(-100,80)
right(150)
fd(10)
left(60)
circle(-80,98)
end_fill()

penup()
left(60)
fd(13)
left(180)

pendown()
speed(1)
circle(-200,23)

exitonclick()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163

three 圣诞树

  • 圣诞树 (动态生成效果)
    在这里插入图片描述
    代码:
from turtle import *
import random
import time

n = 100.0

speed(“fastest”)
screensize(bg=‘seashell’)
left(90)
forward(3*n)
color(“orange”, “yellow”)
begin_fill()
left(126)

for i in range(5):
forward(n/5)
right(144)
forward(n/5)
left(72)
end_fill()
right(126)

color(“dark green”)
backward(n4.8)
def tree(d, s):
if d <= 0: return
forward(s)
tree(d-1, s.8)
right(120)
tree(d-3, s.5)
right(120)
tree(d-3, s.5)
right(120)
backward(s)
tree(15, n)
backward(n/2)

for i in range(200):
a = 200 - 400 random.random()
b = 10 - 20 random.random()
up()
forward(b)
left(90)
forward(a)
down()
if random.randint(0, 1) == 0:
color(‘tomato’)
else:
color(‘wheat’)
circle(2)
up()
backward(a)
right(90)
backward(b)

time.sleep(60)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57

未完待续!

                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-526ced5128.css" rel="stylesheet">
                </div>
</article>
<div class="postTime"> 
    <div class="article-bar-bottom">
        <span class="time">
            文章最后发布于: 2019-10-22 21:59:00            </span>
    </div>
</div>
        <div class="hide-article-box hide-article-pos text-center">
        <a class="btn-readmore" data-report-view="{&quot;mod&quot;:&quot;popu_376&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;,&quot;strategy&quot;:&quot;readmore&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_376&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;,&quot;strategy&quot;:&quot;readmore&quot;}">
            展开阅读全文
            <svg class="icon chevrondown" aria-hidden="true">
                <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#csdnc-chevrondown"></use>
            </svg>
        </a>
    </div>
            <!--打赏开始-->
                        <div class="reward-user-box">
                <span class="reward-word" style="color:#B4B4B4 !important">有 <span class="num">0</span> 个人打赏</span>
                                </div>
                    <!--打赏结束-->
        <div class="recommend-box"><div class="recommend-item-box type_blog clearfix" data-report-view="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/sinat_36184075/article/details/80357696&quot;,&quot;strategy&quot;:&quot;BlogCommendFromMachineLearnPai2&quot;,&quot;index&quot;:&quot;0&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/sinat_36184075/article/details/80357696&quot;,&quot;strategy&quot;:&quot;BlogCommendFromMachineLearnPai2&quot;,&quot;index&quot;:&quot;0&quot;}">
<div class="content" style="width: 962px;">
	<a href="https://blog.csdn.net/sinat_36184075/article/details/80357696" target="_blank" rel="noopener" title="【python】使用python自动画一只小猪佩奇(源码)">
	<h4 class="text-truncate oneline" style="width: 802px;">
			【<em>python</em>】使用<em>python</em>自动<em>画</em>一只小猪佩奇(源码)		</h4>
	<div class="info-box d-flex align-content-center">
		<p class="date-and-readNum oneline">
			<span class="date hover-show">05-17</span>
			<span class="read-num hover-hide">
				阅读数 
				3万+</span>
			</p>
		</div>
	</a>
	<p class="content" style="width: 962px;">
		<a href="https://blog.csdn.net/sinat_36184075/article/details/80357696" target="_blank" rel="noopener" title="【python】使用python自动画一只小猪佩奇(源码)">
			<span class="desc oneline">该程序需要在windows的pythonIDLE环境下运行,效果如图:#!/usr/bin/envpython2#coding=utf-8importturtleastt.pensize(4)t.hi...</span>
		</a>
		<span class="blog_title_box oneline ">
								<span class="type-show type-show-blog type-show-after">博文</span>
										<a target="_blank" rel="noopener" href="https://blog.csdn.net/sinat_36184075">来自:	<span class="blog_title"> 嵌入式软件开发基地</span></a>
											</span>
	</p>
</div>
</div>
还能输入1000个字符
<div class="comment-list-container">
	<a id="comments"></a>
	<div class="comment-list-box" style="max-height: 231px;"><ul class="comment-list"><li class="comment-line-box d-flex" data-commentid="10827271" data-replyname="qq_36535820">      <a target="_blank" href="https://me.csdn.net/qq_36535820"><img src="https://profile.csdnimg.cn/B/2/3/3_qq_36535820" username="qq_36535820" alt="qq_36535820" class="avatar"></a>        <div class="right-box ">          <div class="new-info-box clearfix">            <a target="_blank" href="https://me.csdn.net/qq_36535820"><span class="name ">*MuYu*</span></a><span class="date" title="2019-10-30 18:41:40">1周前</span><span class="floor-num">#47楼</span><span class="new-comment">我只有第一个能运行出来,其他的全部代码报错,红波浪杠杠,调的包好像不对呀</span><span class="new-opt-box"><a class="btn btn-link-blue btn-report" data-type="report">举报</a><a class="btn btn-link-blue btn-reply" data-type="reply">回复</a><a class="btn btn-link-blue btn-read-reply" data-type="readreply">查看回复(1)</a></span></div><div class="comment-like " data-commentid="10827271"><svg t="1569296798904" class="icon " viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5522" width="200" height="200"><path d="M726.016 906.666667h-348.586667a118.016 118.016 0 0 1-116.992-107.904l-29.013333-362.666667A117.589333 117.589333 0 0 1 348.458667 309.333333H384c126.549333 0 160-104.661333 160-160 0-51.413333 39.296-88.704 93.397333-88.704 36.906667 0 71.68 18.389333 92.928 49.194667 26.88 39.04 43.178667 111.658667 12.714667 199.509333h95.530667a117.418667 117.418667 0 0 1 115.797333 136.106667l-49.28 308.522667a180.608 180.608 0 0 1-179.072 152.704zM348.458667 373.333333l-4.48 0.170667a53.461333 53.461333 0 0 0-48.768 57.472l29.013333 362.666667c2.218667 27.52 25.6 49.024 53.205333 49.024h348.544a116.949333 116.949333 0 0 0 115.925334-98.816l49.322666-308.736a53.418667 53.418667 0 0 0-52.650666-61.781334h-144.085334a32 32 0 0 1-28.458666-46.634666c45.909333-89.130667 28.885333-155.434667 11.562666-180.522667a48.981333 48.981333 0 0 0-40.192-21.504c-6.912 0-29.397333 1.792-29.397333 24.704 0 111.317333-76.928 224-224 224h-35.541333zM170.624 906.666667a32.042667 32.042667 0 0 1-31.872-29.44l-42.666667-533.333334a32.042667 32.042667 0 0 1 29.354667-34.474666c17.066667-1.408 33.024 11.733333 34.432 29.354666l42.666667 533.333334a32.042667 32.042667 0 0 1-31.914667 34.56z" p-id="5523"></path></svg><span></span></div></div></li><li class="replay-box"><ul class="comment-list"><li class="comment-line-box d-flex" data-commentid="10894202" data-replyname="weixin_42273543">      <a target="_blank" href="https://me.csdn.net/weixin_42273543"><img src="https://profile.csdnimg.cn/D/8/5/3_weixin_42273543" username="weixin_42273543" alt="weixin_42273543" class="avatar"></a>        <div class="right-box reply-box">          <div class="new-info-box clearfix">            <a target="_blank" href="https://me.csdn.net/weixin_42273543"><span class="name mr-8">长望北</span></a><span class="text">回复</span>  <span class="nick-name">*MuYu*</span><span class="date" title="2019-11-10 18:23:14">5小时前</span><span class="text"></span><span class="new-comment">

不影响运行举报回复

  • u011311176
    皮皮毅. 9小时前 #45楼 我用pychram运行的
    很完美,但是为啥玫瑰画起来有种突然就完成的感觉
    举报回复
  • qq_45836670
    qq_45836670 9小时前 #43楼 为什么我的第二个樱花那个图的def tree(n,1)1总是报错啊啊啊 举报回复

  • 上一页
  • 1
  • 2
  • 3
  • 4
  • 5
  • 下一页




小试牛刀——用python一朵美丽的玫瑰

12-10 阅读数 1万+

小试牛刀——用python画一朵美丽的玫瑰花~~ 博文 来自: 禾白小的博客

<div class="recommend-item-box recommend-recommend-box"><div id="kp_box_59" data-pid="59"><script type="text/javascript">
(function() {
    var s = "_" + Math.random().toString(36).slice(2);
    document.write('<div style="" id="' + s + '"></div>');
    (window.slotbydup = window.slotbydup || []).push({
        id: "u3491668",
        container:  s
    });
})();

python3用turtle模块一棵随机樱花树 - 執筆冩回憶 - CSDN博客

11-10

使用Python中的turtle简单绘制一颗心 - weixin_4493961..._CSDN博客

11-10

<div class="recommend-item-box recommend-recommend-box"><div id="kp_box_60" data-pid="60"><iframe src="https://adaccount.csdn.net/#/preview/261?m=EcQALptQHcDpSAynHinpcpEiEJtQbbLibbSmJJUHXbQSAHbptDLbJXSAiLpStcHAQLWEbLDUpEbovbicXSLoyJitJHADSiEQnnbQ&amp;k=" frameborder="0" width="100%" height="75px" scrolling="no"></iframe><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?d=2&amp;k=&amp;m=EcQALptQHcDpSAynHinpcpEiEJtQbbLibbSmJJUHXbQSAHbptDLbJXSAiLpStcHAQLWEbLDUpEbovbicXSLoyJitJHADSiEQnnbQ"></div></div>
Python一只溜达小狗——turtle库基础入门 - toto+..._CSDN博客

11-9

技术图文:如何利用 Turtle 绘制一棵漂亮樱花树 - 老..._CSDN博客

10-28

		<div class="recommend-item-box blog-expert-recommend-box" style="display: block;">
		<div class="d-flex">
			<div class="blog-expert-recommend">
				<div class="blog-expert">
					<div class="blog-expert-flexbox" data-report-view="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><a href="https://blog.csdn.net/sinat_36184075" target="_blank"><img src="https://profile.csdnimg.cn/C/B/8/3_sinat_36184075" username="sinat_36184075" alt="不才b_d" title="不才b_d"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="sinat_36184075" data-nick="不才b_d">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><a href="https://blog.csdn.net/sinat_36184075" target="_blank"><h5 class="oneline" title="不才b_d">不才b_d</h5></a></span>  <p></p><p class="article-num" title="233篇文章"> 233篇文章</p><p class="article-num" title="排名:6000+"> 排名:6000+</p><p></p></div></div></div><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><a href="https://blog.csdn.net/z564359805" target="_blank"><img src="https://profile.csdnimg.cn/1/4/B/3_z564359805" username="z564359805" alt="执笔写回憶" title="执笔写回憶"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="z564359805" data-nick="执笔写回憶">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><a href="https://blog.csdn.net/z564359805" target="_blank"><h5 class="oneline" title="执笔写回憶">执笔写回憶</h5></a></span>  <p></p><p class="article-num" title="165篇文章"> 165篇文章</p><p class="article-num" title="排名:千里之外"> 排名:千里之外</p><p></p></div></div></div><div class="blog-expert-item"><div class="blog-expert-info-box"><div class="blog-expert-img-box" data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><a href="https://blog.csdn.net/qq_36772866" target="_blank"><img src="https://profile.csdnimg.cn/1/3/C/3_qq_36772866" username="qq_36772866" alt="Ken Coding" title="Ken Coding"></a><span data-report-click="{&quot;mod&quot;:&quot;popu_710&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><span class="blog-expert-button-follow btn-red-follow" data-name="qq_36772866" data-nick="Ken" coding="">关注</span></span></div><div class="info"><span data-report-click="{&quot;mod&quot;:&quot;popu_709&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/weixin_43943977/article/details/102691392&quot;}"><a href="https://blog.csdn.net/qq_36772866" target="_blank"><h5 class="oneline" title="Ken Coding">Ken Coding</h5></a></span>  <p></p><p class="article-num" title="800篇文章"> 800篇文章</p><p class="article-num" title="排名:2000+"> 排名:2000+</p><p></p></div></div></div></div>
				</div>
			</div>
		</div>
	</div><div class="recommend-item-box baiduSearch recommend-box-ident" data-report-view="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/oh5W6HinUg43JvRhhB/article/details/95937358&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;5&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/oh5W6HinUg43JvRhhB/article/details/95937358&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;5&quot;}" data-track-view="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/oh5W6HinUg43JvRhhB/article/details/95937358&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:4,&quot;extend1&quot;:&quot;_&quot;}" data-track-click="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/oh5W6HinUg43JvRhhB/article/details/95937358&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:4,&quot;extend1&quot;:&quot;_&quot;}" data-flg="true">                <a href="https://blog.csdn.net/oh5W6HinUg43JvRhhB/article/details/95937358" target="_blank">              		<h4 class="text-truncate oneline" style="width: 884px;"><em>Python</em>花式编程:6种方法计算1!+2!+...+n! - <em>Python</em>小屋 - CSDN博客</h4>                  <div class="info-box d-flex align-content-center">                    <p>                      <span class="date">11-8</span>                    </p>                  </div>                </a>            	</div><div class="recommend-item-box baiduSearch recommend-box-ident" data-report-view="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/Mrs_Cheng/article/details/98359704&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;6&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/Mrs_Cheng/article/details/98359704&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;6&quot;}" data-track-view="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/Mrs_Cheng/article/details/98359704&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:5,&quot;extend1&quot;:&quot;_&quot;}" data-track-click="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;https://blog.csdn.net/Mrs_Cheng/article/details/98359704&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:5,&quot;extend1&quot;:&quot;_&quot;}" data-flg="true">                <a href="https://blog.csdn.net/Mrs_Cheng/article/details/98359704" target="_blank">              		<h4 class="text-truncate oneline" style="width: 884px;"><em>python</em>3.7.* 用turtle库<em>画</em>一棵随机<em>樱花树</em> - Mrs_Cheng..._CSDN博客</h4>                  <div class="info-box d-flex align-content-center">                    <p>                      <span class="date">11-8</span>                    </p>                  </div>                </a>            	</div>
让人意想不到的Python樱花树(turtle库的华丽样式) - ..._CSDN博客

11-10

python3用turtle模块一棵随机樱花树 - 路漫漫其修远..._CSDN博客

11-10

<div class="recommend-item-box recommend-recommend-box"><div id="kp_box_61" data-pid="61"><iframe src="https://adaccount.csdn.net/#/preview/749?m=EtLpbLAcQEQbiALbHDQJpLiEotJHcUiSJLUmHbJSXSSppcpnnHyiJtEAJfLonJHSQtWSAJnEnJcALbAmnnEUXotQDcHEUniJQJpQ&amp;k=" frameborder="0" width="100%" height="75px" scrolling="no"></iframe><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?d=2&amp;k=&amp;m=EtLpbLAcQEQbiALbHDQJpLiEotJHcUiSJLUmHbJSXSSppcpnnHyiJtEAJfLonJHSQtWSAJnEnJcALbAmnnEUXotQDcHEUniJQJpQ"></div></div><div class="recommend-item-box baiduSearch recommend-box-ident" data-report-view="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;http://blog.csdn.net/Pythoncxy/article/details/100039065&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;9&quot;}" data-report-click="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;http://blog.csdn.net/Pythoncxy/article/details/100039065&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:&quot;9&quot;}" data-track-view="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;http://blog.csdn.net/Pythoncxy/article/details/100039065&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:8,&quot;extend1&quot;:&quot;_&quot;}" data-track-click="{&quot;mod&quot;:&quot;popu_614&quot;,&quot;dest&quot;:&quot;http://blog.csdn.net/Pythoncxy/article/details/100039065&quot;,&quot;strategy&quot;:&quot;searchFromBaidu1&quot;,&quot;index&quot;:8,&quot;extend1&quot;:&quot;_&quot;}" data-flg="true">                <a href="http://blog.csdn.net/Pythoncxy/article/details/100039065" target="_blank">              		<h4 class="text-truncate oneline" style="width: 876px;"><em>Python</em><em>画</em><em>樱花树</em> ! - <em>Python</em>cxy的博客 - CSDN博客</h4>                  <div class="info-box d-flex align-content-center">                    <p>                      <span class="date">11-10</span>                    </p>                  </div>                </a>            	</div>
<div class="recommend-item-box recommend-recommend-box"><div id="kp_box_62" data-pid="62"><iframe src="https://adaccount.csdn.net/#/preview/733?m=cSnfbvbiSpLHiLDtQLJSQiiHpbcEUpUESAbSQSntinHnnEJSXSJnDHbLbytUUHpSnQtAWpbpccicQpXEXnLnAcJcSLEiibHDQitQ&amp;k=" frameborder="0" width="100%" height="75px" scrolling="no"></iframe><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?d=2&amp;k=&amp;m=cSnfbvbiSpLHiLDtQLJSQiiHpbcEUpUESAbSQSntinHnnEJSXSJnDHbLbytUUHpSnQtAWpbpccicQpXEXnLnAcJcSLEiibHDQitQ"></div></div>
葛优:你们有看过我的作品吗?| 今日趣图

10-20 阅读数 13

全世界只有3.14%的人关注了青少年数学之旅 博文 来自: 数据与算法之美

<div class="recommend-item-box recommend-recommend-box"><div id="kp_box_63" data-pid="63"><script type="text/javascript">
    (function() {
        var s = "_" + Math.random().toString(36).slice(2);
        document.write('<div style="" id="' + s + '"></div>');
        (window.slotbydup = window.slotbydup || []).push({
            id: "u4221910",
            container: s
        });
    })();

<div class="recommend-item-box recommend-recommend-box"><div id="kp_box_64" data-pid="64"><script type="text/javascript">
(function() {
    var s = "_" + Math.random().toString(36).slice(2);
    document.write('<div style="" id="' + s + '"></div>');
    (window.slotbydup = window.slotbydup || []).push({
        id: "u3600856",
        container:  s
    });
})();

<div class="recommend-item-box recommend-recommend-box"><div id="kp_box_65" data-pid="65"><iframe src="https://adaccount.csdn.net/#/preview/575?m=EAcQJSibvHLcEitJcyHEcDbnbJDpLniicnAEpHXvSJAHJpJAvnbpyJvpbbbppAHpbQtWEJipbQoAQvpJXQncLnmHJEAcQJpnAiJQ&amp;k=" frameborder="0" width="100%" height="75px" scrolling="no"></iframe><img class="pre-img-lasy" data-src="https://kunyu.csdn.net/1.png?d=2&amp;k=&amp;m=EAcQJSibvHLcEitJcyHEcDbnbJDpLniicnAEpHXvSJAHJpJAvnbpyJvpbbbppAHpbQtWEJipbQoAQvpJXQncLnmHJEAcQJpnAiJQ"></div></div>
<div class="recommend-item-box recommend-recommend-box"><div id="kp_box_66" data-pid="66"><div id="three_ad38" class="mediav_ad"></div>
2019年9月全国程序员工资统计

09-05 阅读数 2万+

2019年9月2日,统计了某招聘网站上的所有程序员招聘信息。并汇总如下。 博文

我花了一夜用数据结构给女朋友写个H5走迷宫游戏

09-21 阅读数 13万+

起因

又到深夜了,我按照以往在csdn和公众号写着数据结构!这占用了我大量的时间!我的超越妹妹严重缺乏陪伴而 怨气满满!

而女朋友时常埋怨,认为数据结构这么抽象难懂的东西没啥作用,常会问道…


博文



作者|王琳

本文经授权转载自燃财经(ID:rancaijing)

9月10日,张勇转正了,他由阿里巴巴董事局…


博文



<div class="recommend-item-box recommend-recommend-box"><div id="_bi11a0ecjti" style=""><div id="esdnajlkt" style="width:0px;height:0px;"></div><iframe width="900" frameborder="0" height="90" scrolling="no" src="https://pos.baidu.com/s?hei=90&amp;wid=900&amp;di=u3491668&amp;ltu=https%3A%2F%2Fblog.csdn.net%2Fweixin_43943977%2Farticle%2Fdetails%2F102691392&amp;psi=c2429c8c53af73c6c1e86370fb5e29cd&amp;ti=Python%E2%80%94%E2%80%94%E7%94%BB%E4%B8%80%E6%A3%B5%E6%BC%82%E4%BA%AE%E7%9A%84%E6%A8%B1%E8%8A%B1%E6%A0%91%EF%BC%88%E4%B8%8D%E5%90%8C%E7%A7%8D%E6%A8%B1%E8%8A%B1%2B%E7%8E%AB%E7%91%B0%2B%E5%9C%A3%E8%AF%9E%E6%A0%91%E5%96%94%EF%BC%89&amp;psr=1920x1080&amp;chi=1&amp;ari=2&amp;col=zh-CN&amp;dri=1&amp;cfv=0&amp;par=1920x1030&amp;ant=0&amp;tlm=1573401146&amp;cpl=20&amp;dtm=HTML_POST&amp;prot=2&amp;cdo=-1&amp;pis=-1x-1&amp;pcs=1899x907&amp;ltr=https%3A%2F%2Fwww.csdn.net%2Fnav%2Fpython&amp;ps=17319x622&amp;exps=111000&amp;drs=1&amp;cja=false&amp;cec=UTF-8&amp;pss=1899x20146&amp;tpr=1573401146172&amp;cce=true&amp;cmi=37&amp;ccd=24&amp;tcn=1573401146&amp;dis=0&amp;dc=3&amp;dai=4"></iframe></div><script type="text/javascript" src="//rabc1.iteye.com/production/res/rxjg.js?pkcgstj=jm"></script></div>
让程序员崩溃的瞬间(非程序员勿入)

09-16 阅读数 18万+

今天给大家带来点快乐,程序员才能看懂。

来源:https://zhuanlan.zhihu.com/p/47066521

  1. 公司实习生找 Bug

2.在调试时,将断点设…


博文



用Python分析2000款避孕套,得出这些有趣的结论

09-18 阅读数 3万+

到现在为止,我们的淘宝教程已经写到了第四篇,前三篇分别是:

第一篇:Python模拟登录淘宝,详细讲解如何使用requests库登录淘宝pc端。
第二篇:淘宝自动登录2.0,新增Cookies序列化…


博文



Java 13 新特性全面解读

09-21 阅读数 1241

作者 l Hollis

本文经授权转载自Hollis(ID:hollischuang)

2017年8月,JCP执行委员会提出将Java的发布频率改为每六个月一次,新的发布周期严格遵循时间点,将在每…


博文



<div class="recommend-item-box recommend-recommend-box"><div style="width: 100%;"><iframe width="900" frameborder="0" height="90" scrolling="no" src="//pos.baidu.com/s?hei=90&amp;wid=900&amp;di=u3491668&amp;ltu=https%3A%2F%2Fblog.csdn.net%2Fweixin_43943977%2Farticle%2Fdetails%2F102691392&amp;psi=c2429c8c53af73c6c1e86370fb5e29cd&amp;ant=0&amp;psr=1920x1080&amp;cfv=0&amp;dtm=HTML_POST&amp;cpl=20&amp;tlm=1573401146&amp;tpr=1573401146172&amp;ti=Python%E2%80%94%E2%80%94%E7%94%BB%E4%B8%80%E6%A3%B5%E6%BC%82%E4%BA%AE%E7%9A%84%E6%A8%B1%E8%8A%B1%E6%A0%91%EF%BC%88%E4%B8%8D%E5%90%8C%E7%A7%8D%E6%A8%B1%E8%8A%B1%2B%E7%8E%AB%E7%91%B0%2B%E5%9C%A3%E8%AF%9E%E6%A0%91%E5%96%94%EF%BC%89&amp;drs=1&amp;cce=true&amp;ps=17825x622&amp;par=1920x1030&amp;cdo=-1&amp;ccd=24&amp;pis=-1x-1&amp;cmi=37&amp;pss=1899x20242&amp;exps=111000&amp;tcn=1573401146&amp;pcs=1899x907&amp;cja=false&amp;dai=5&amp;dc=3&amp;ltr=https%3A%2F%2Fwww.csdn.net%2Fnav%2Fpython&amp;cec=UTF-8&amp;dri=2&amp;prot=2&amp;chi=1&amp;ari=2&amp;dis=0&amp;col=zh-CN"></iframe><abbr id="wynvaf" style="width:0px;height:0px;visibility:visible;"></abbr></div><script type="text/javascript" src="//rabc1.iteye.com/production/res/rxjg.js?pkcgstj=jm"></script></div>

线程
进程中的一个执行任务…


博文



动画:用动画给面试官解释 TCP 三次握手过程

10-12 阅读数 2万+

作者 | 小鹿 来源 | 公众号:小鹿动画学编程

写在前边
TCP 三次握手过程对于面试是必考的一个,所以不但要掌握 TCP 整个握手的过程,其中有些小细节也更受到面试官的青睐。
对于…


博文



帮助蹲厕族、YP族、饭圈女孩在无聊之余可以有一样东西让他们振作起来!让他们的左手 / …


博文



唐僧团队要裁员,你会裁谁?

10-15 阅读数 3万+

提问:

西游记取经团为了节约成本,唐太宗需要在这个团队里裁掉一名队员,该裁掉哪一位呢,为什么?

为了完成西天取经任务,组成取经团队,成员有唐僧、孙悟空、猪八戒、沙和尚、白龙马。
高层领导: 观音…


博文



只因写了一段爬虫,公司200多人被抓!

10-16 阅读数 9万+

“一个程序员写了个爬虫程序,整个公司200多人被端了。”

“不可能吧!”

刚从朋友听到这个消息的时候,我有点不太相信,做为一名程序员来讲,谁还没有写过几段爬虫呢?只因写爬虫程序就被端有点夸张了吧。…


博文



动画:用动画给女朋友讲解 TCP 四次分手过程

10-21 阅读数 2万+

作者 | 小鹿 来源 | 公众号:小鹿动画学编程

写在前边
大家好,我们又见面了,做为一个业余的动画师,上次的用动画的形式讲解 TCP 三次握手过程再各大平台收到了广大读者的喜爱,说文章有趣、有…


博文



  • 10
    点赞
  • 54
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值