python3.10安装官网以及python代码
•文章
250 0
python解释器官网,直接进去下载即可,相信聪明的你不用教程也可以,因为太简单了
https://www.python.org/downloads/windows/
下载完编辑器可以在下载一个编辑器,例如pycham
没有解释器的话无论什么编辑器软件都不能运行的
pyinstaller -F hello.py
sudo apt-get install python3-tk
分享一些python代码,持续更新,也欢迎一起学习的朋友来投稿,知识不要吝啬,毕竟不是你不分享别人就不会的,只是知道的早晚而已,欢迎大家一起学习投稿
#画鸭子
from turtle import *
#扁嘴
pensize(2)
pu()
goto(-100,100)#上嘴最高顶点
seth(-50)
pd()
color('#6C3100','#FADD77')
begin_fill()
fd(16)
vertex_right = pos()#嘴最右顶点
rt(50)
fd(12)
vertex_down = pos()#下嘴最低顶点
rt(80)
fd(30)
circle(-3,200)
vertex_left = pos()#嘴最左顶点
goto(-100,100)
end_fill()
goto(vertex_left)#回到最左顶点
circle(-3,-200)#扁嘴
goto(vertex_right)
#身体
#头颈背尾曲线
color('#B6A88E')
pu()
goto(-100,100)
pd()
seth(80)
circle(-36,160)
fd(25)
circle(115,20)
circle(60,55)
circle(-200,20)
circle(110,20)
color('#7D6A4C')
circle(40,40)
color('#B6A88E')
seth(-100)
circle(-180,30)
circle(-20,50)
#右鸭腿
circle(20,70)
color('#736856')
circle(-12,120)
leg_pos1 = pos()#定位左腿位置
fd(25)
#前胸肚曲线
pu()
goto(vertex_down)
pd()
seth(-10)
color('#B9AD9D')
circle(-40,50)
circle(-80,48)
color('#736856')
circle(250,5)
circle(50,75)
color('#B9AD9D')
circle(220,28)
#左鸭腿
pu()
seth(175)
fd(40)
pd()
seth(-120)
fd(8)
circle(-10,120)
leg_pos2 = pos()#定位右腿位置
fd(15)
#眼睛
color('black')
#左眼
pu()
goto(vertex_down - (1,-29))
pd()
dot(4,'black')#相比circle(),不需要再额外填充颜色
#右眼
pu()
goto(vertex_down + (23,20))
pd()
dot(4,'black')
#翅膀
color('#BCB2A6')
pu()
goto(vertex_down - (-75,130))
seth(130)
pd()
circle(-25,130)
circle(-100,30)
fd(85)
point = pos()
rt(137)
fd(52)
circle(-100,58)
pu()
goto(point)
lt(30)
pd()
fd(60)
pu()
goto(point)
pd()
lt(10)
fd(70)
#腿部
#左腿
def leg(pos0):#鸭腿绘制函数
pensize(8)
color('#ECC578')
pu()
goto(pos0)
seth(0)
fd(7)
seth(-90)
fd(8.5)
pd()
fd(20)#腿长
leg(leg_pos1)
leg(leg_pos2)
#小红靴——函数
def boot(pos0):
pensize(2)
color('#B4070B','#FBA06B')
pu()
goto(pos0)#靴子右上顶点
pd()
begin_fill()
seth(140)
circle(25,80)
seth(-80)
fd(35)#fd(30)左侧线条
circle(-2,60)#靴低
fd(20)
circle(4,180)
seth(5)
fd(30)
circle(2,60)
goto(pos0)#右侧线条
end_fill()
boot(leg_pos1-(-20,30))
boot(leg_pos2-(-20,30))
#小雨滴
color('#77DDFF','#D8E8E5')
fd_ls = [200,140,250,240,230,220,180,250]
lt_ls = [30,60,60,100,125,170,200,330]
for i in range(8):
pu()
home()
lt(lt_ls[i])
fd(fd_ls[i])
pd()
seth(-78)
fd(15)
begin_fill()
circle(-3,200)
end_fill()
fd(15)
#文字
pu()
goto(vertex_left)
seth(180)
fd(150)
seth(-90)
fd(300)
color('black')
write('code by totoup',font=("Arial",15,"normal"))
hideturtle()
done()
#九九乘法表
for i in range(1,10):
for j in range(1,i+1):
print(f'{i}*{j}={i*j}',end=" ")
print(" ")
还有一个打印爱心的代码print('\n'.join([''.join([('lovelovelove'[(x-y)%12]if((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3<=0 else' ')for x in range(-30,30)])for y in range(15,-15,-1)]))
当然你也可以将代码中的love修改,保持12个字符就可以了,要是觉得打印的比较low,我还有一个画爱心的代码 如下:import turtle
def curvemove():
for i in range(200):
turtle.right(1)
turtle.forward(1)
turtle.color('red')
turtle.begin_fill()
turtle.left(140)
turtle.forward(111.65)
curvemove()
turtle.left(120)
curvemove()
turtle.forward(111.65)
turtle.end_fill()
turtle.penup()
turtle.goto(-40, -50)
turtle.pendown()
turtle.write('我爱你', font = ('SimHei', 15, 'bold'))
turtle.hideturtle()
python发送邮件代码,改成自己的即可“食用”import smtplib
from email.mime.text import MIMEText
from email.header import Header
# 写邮件
msg = MIMEText("Hello,world!来自自己的第一封信。", "plain") # plain表示纯文字,若是html页面则改为html
msg["Subject"] = Header("来自Python的信~") # 主题
msg["To"] = Header("自己") # 接收者的称呼
msg["From"] = Header("戏人看戏") # 发送者的称呼
# Send
try:
smtp_obj = smtplib.SMTP_SSL("smtp.qq.com", 465) # 不同邮箱地址和端口不一样,详情见下
smtp_obj.login("bwsnb@vip.qq.com", "*******") # QQ邮箱账号与密码
smtp_obj.sendmail("bwsnb@vip.qq.com", "3500079813@qq.com", msg.as_string()) # 发送者的邮箱和接受者的邮箱
print("mail has been send successfully.")
except smtplib.SMTPException as e:
print(e)
版权属于:戏人看戏博客网
本文链接:https://day.nb.sb/archives/219.html
若无注明均为戏人看戏原创,转载请注明出处,感谢您的支持!