自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 收藏
  • 关注

原创 python爬虫网页图片

#图片爬虫'''import requestsr=requests.get(''复制的url链接')path='../picture/1.jpg'try: f=open(path,'wb',) f.write(r.content) #写入二进制文件 f.close() print('文件保存成功')except: print('爬虫失败!')'''...

2022-01-07 10:30:31 516

原创 xlsx转csv

import xlrdimport csvdef xlsx_to_csv(): workbook = xlrd.open_workbook('???.xlsx') table = workbook.sheet_by_index(0) with codecs.open('???.csv', 'w', encoding='utf-8') as f: write = csv.writer(f) for row_num in range(table.n.

2022-01-07 07:42:37 238

原创 Python的标准库与第三方库

Python的标准库名称 作用datetime 为日期和时间处理同时提供了简单和复杂的方法zlib 直接支持通用的数据打包和压缩格式:zlib,gzip,bz2,zipfile,以及 tarfilerandom 提供了生成随机数的工具math 为浮点运算提供了对底层C函数库的访问sys 工具脚本经常调用命令行参数。这些命令行参数以链表形式存储于 sys 模块的 argv 变量glob 提供了一个函数用于从目录通配符搜索中生成文件列表os 提供...

2022-01-07 07:30:16 380

原创 python折线图

import matplotlibimport numpy as npfrom matplotlib import pyplot as plt%matplotlib inline#通用设置matplotlib.rc('axes', facecolor = 'white')matplotlib.rc('figure', figsize = (6, 4))matplotlib.rc('axes', grid = False)#数据及线属性plt.plot(x, y,'*:r')#标...

2022-01-06 21:57:22 778

原创 数字晶码管--数字8

import turtle as timport timeline=80pad=20t.pensize(20)t.up()t.ht()t.colormode(255)t.tracer(False)t.speed(0)def hor(x=0,y=0): t.pencolor('black') t.goto(x+pad,y) t.down() t.fd(line) t.up() t.home()def vec(x=0,y=0): t.

2022-01-06 21:44:12 401

原创 用python画五角星

import turtleturtle.fillcolor("red")turtle.begin_fill()while True: turtle.forward(220) turtle.right(144) if abs(turtle.pos()) < 1: breakturtle.fd(84)for i in range(5): turtle.fd(52) turtle.right(72)turtle.end_fill(.

2022-01-06 21:38:24 300

原创 晶体管表示时间

import turtle as timport random as ranimport timeline=20pad=2t.pensize(3)t.up()t.ht()t.colormode(255)t.tracer(False)t.speed(0)t.setup(1024,700) def hor(x=0,y=0):#横(从左到右) t.pencolor('red') t.goto(x+pad,y) t.down() t.fd(line) ..

2022-01-06 21:37:29 89

转载 用python画圣诞树

import turtlescreen = turtle.Screen()screen.setup(800,600)circle = turtle.Turtle()circle.shape('circle')circle.color('red')circle.speed('fastest')circle.up()square = turtle.Turtle()square.shape('square')square.color('green')square.speed('fastes.

2022-01-06 19:57:11 106

原创 用python画正方形

import turtle turtle.title("正方形")turtle.pensize(5) turtle.pencolor("red") turtle.fillcolor("yellow") turtle.begin_fill() for i in range(4): turtle.forward(200) turtle.left(90) turtle.end_fill() turt.

2022-01-05 21:10:36 8020 1

原创 九九乘法口诀

def abc(): # 九九乘法表 for i in range(1, 10): for j in range(1, i+1): print('{}x{}={}\t'.format(j, i, i*j), end='') if __name__ == '__main__': abc()绘制结果

2022-01-01 14:26:29 158

原创 用python绘制爱心

from turtle import *def curvemove(): for i in range(200): right(1) forward(1)color('red') begin_fill()left(140)forward(111.65)curvemove()left(116)curvemove()forward(111.70)end_fill()done()效果展示

2022-01-01 14:18:27 351

原创 用python绘制向日葵

import turtleturtle.fillcolor("orange")turtle.begin_fill()while True: turtle.forward(120) turtle.right(105) if abs(turtle.pos()) < 1: breakturtle.fd(84)for i in range(5): turtle.fd(0)turtle.end_fill()turtle.done()绘.

2022-01-01 14:09:11 3468

原创 什么是元组

元组元素值不可以改变,其他属性与列表相同、序列封包和序列解包x = ([1,2,3])x[0][0] = 'a'(['a',2],3)x[0][1]='b'x(['a','b'],3)

2021-12-22 14:04:19 177

原创 if语句使用

if表达式:语句逻辑:当程序执行到if语句时,首先计算表达式的值,如果表达式为“True”则执行if下的“语句”,如果为“False”则跳过整个if语句继续向下执行判断奇偶数

2021-12-22 13:45:53 174

原创 1-100数列求和

sum=0for i in range(1,101): sum=sum+iprint("1+2+3+……+100=",sum)执行运行命令我们可以得到1+2+3+……+100=5050

2021-12-22 13:38:08 585

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除