- 博客(9)
- 收藏
- 关注
原创 pyqt窗口
from PyQt5.QtGui import QPixmapfrom PyQt5 import QtCore, QtWidgetsfrom PyQt5.QtWidgets import *import sysimport qtawesomefrom openpyxl import *import reclass Test_1(QtWidgets.QMainWindow): def __init__(self): super().__init__() .
2021-10-08 20:12:33
194
原创 python识图
import pytesseractfrom PIL import Imageimage = Image.open(r' .jpg')#图片路径code = pytesseract.image_to_string(image, lang="chi_sim+eng")print(code)
2021-08-07 23:30:13
254
原创 python读取excel
import xlrd#xlrd2.0版本只能读取xls#xlrd1.0.2版本能读取xlsxdef read_excel(): # 打开文件 workBook = xlrd.open_workbook(r'D:\aa.xlsx'); # 1.2 按索引号获取sheet的名字(string类型) # sheet1Name = workBook.sheet_names()[0]; # print(sheet1Name); # 2. 获取sheet内.
2021-08-07 23:22:54
286
原创 python爬虫静态网页获取图片
import requestsfrom lxml import etreefrom PIL import Imagefrom io import BytesIOheaders = {'网页头'}def getdate_text(url,headers): response = requests.get(url, headers=headers) response.encoding = 'utf-8' return response.texturl = '域名'hq .
2021-08-07 23:19:02
171
原创 python创建折线图和散点图
from matplotlib import pyplotimport matplotlib.pyplot as pltyear = [2010, 2012, 2014, 2016]people = [20, 40, 60, 100]#生成图表plt.rcParams['font.sans-serif']=['SimHei']#坐标轴中文化显示pyplot.plot(year, people)#如果要生成散点图,只需将代码中的plot改成scatterpyplot.xlabel('year'.
2021-08-07 23:12:18
371
原创 python创建条形图且使坐标轴和标题中文化显示
import matplotlib.pyplot as pltplt.rcParams['font.sans-serif']=['SimHei']#使坐标轴和标题中文显示plt.bar([1, 3, 5, 7, 9], [5, 4, 8, 12, 7], label='graph 1')# x: 条形图x轴# y:条形图的高度# width:条形图的宽度 默认是0.8# bottom:条形底部的y坐标值 默认是0plt.legend()plt.xlabel('横坐标')pl.
2021-08-07 23:08:03
753
原创 python爬虫tap热门游戏榜
获取网页请求import requestsfrom lxml import etreeimport jsonfrom openpyxl import Workbookfrom PIL import Imagefrom io import BytesIOimport oslist_1 = []list_3 = []headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (K..
2021-08-07 22:55:07
1685
1
原创 python高级语法
#用for循环实现把字符串变成Unicode码未的列表:a='!@#$%^&*('codes=[]for i in a: codes.append(ord(i))print(codes)#怎样用列表推导式把字符串变成Unicode码位的列表a="!@#$"codes=[ord(s) for s in a]print(codes)#很明显,⽤列表推导式实现⽐ for 循环加 append 更⾼效简洁,可读性更好。#打印出两个列表的笛卡尔积#解法1:使⽤⽣成器表达式产⽣..
2021-08-07 22:49:36
156
原创 python基础
#将字符列表转化为字符串l=['Python','Circle','is','ok']j=''.join(l)print(j)#将字符串居中a='徐以鹏比易烊千玺帅亿点'b=a.center(50)c=a.center(50,'*')print(b)print(c)#find方法找到字符串中的字符,找到就返回第一个字符的索引,找不到就返回-1a='I love python'b=a.find('o')print(b)c=a.find('lov')print(c)#让字符
2021-08-07 22:47:04
113
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人