09 2022 档案
摘要:# -*- coding: utf-8 -*- import requests url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3be1e100-2860-4bc6-9169-xxxxxxxxxxxx' # python调用机器
阅读全文
摘要:# -*- coding: utf-8 -*- import time import schedule import requests url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3be1e100-2860-4bc6-916
阅读全文
摘要:from docx import Document # 创建Document对象 doc = Document() # 添加标题 doc.add_heading('春晓', level=1) # 添加段落 doc.add_paragraph('作者:孟浩然') doc.add_paragraph('
阅读全文
摘要:# -*- coding: utf-8 -*- # 安装 yagmail # pip install yagmail # yagmail.SMTP(user, password, host) user:发件人的邮箱地址, password:邮箱的SMTP服务授权码, host:邮箱的SMTP服务地址
阅读全文
摘要:import openpyxl from openpyxl.chart import LineChart, Reference workbook = openpyxl.load_workbook('file/data.xlsx') sheet = workbook['薪水'] # 创建折线图的图标对
阅读全文
摘要:from docx import Document from docx.oxml.ns import qn from docx.shared import Pt, RGBColor doc = Document('file/春晓.docx') for para in doc.paragraphs:
阅读全文
摘要:带水印的图片: # -*- coding: utf-8 -*- from PIL import Image print('程序进行中...') # img = Image.open('../file/带水印的图片.png') img = Image.open('../file/img.png') #
阅读全文
摘要:# -*- coding: utf-8 -*- from PIL import Image im = Image.open(f'../file/python.png') print('图片大小:', im.size) print(im.getpixel((400, 88))) for i in ra
阅读全文
摘要:原图片 # -*- coding: utf-8 -*- from PIL import Image # 图片的旋转 def demo1(): img = Image.open('../file/python.png') img.rotate(45).save('../file/旋转45度的图片.pn
阅读全文
摘要:# 安装pillow # pip install pillow from PIL import Image # 图片的读取显示与保存 def demo1(): im = Image.open('../file/python.png') im.show() im.save('file/python.p
阅读全文
摘要:# -*- coding: utf-8 -*- from PIL import Image logo = Image.open('../file/logo.png') im = Image.open('../file/拍摄图.png') # 将水印图片添加到图片的指定位置 im.paste(logo
阅读全文
摘要:# -*- coding: utf-8 -*- from PIL import Image im = Image.open('../file/拍摄图.png') # 裁剪图片 def demo1(): box = (200, 0, 400, 150) region = im.crop(box) re
阅读全文
摘要:# -*- coding: utf-8 -*- # 将PDF文档(文字版本)转换为WWord文档频率较高 利用pdf2docx 某块很好的实现这个需求 # 首先安装 pip install pdf2docx import os from pdf2docx import Converter old_f
阅读全文
摘要:# -*- coding: utf-8 -*- import os from win32com.client import Dispatch path = os.getcwd() old_file_path = path + '\\file\\租房合同.docx' new_file_path = p
阅读全文
摘要:# -*- coding: utf-8 -*- import os from win32com.client import Dispatch path = os.getcwd() old_file_path = path + '\\文档.doc' new_file_path = path + '\\
阅读全文
摘要:# -*- coding: utf-8 -*- # 安装 pip install pypiwin32 导入win32com import os from win32com.client import Dispatch import win32com.client path = os.getcwd()
阅读全文
摘要:# -*- coding: utf-8 -*- # 合并多个PDF文档 from PyPDF2 import PdfFileReader, PdfFileWriter def demo1(): pdf_writer = PdfFileWriter() name_list = ["file/a.pdf
阅读全文
摘要:# -*- coding: utf-8 -*- # pip install pyMuPDF 安装pyMuPDF库 import fitz import io from PIL import Image def img(): pdf_file = fitz.open("file/7_2.pdf") f
阅读全文
摘要:# -*- coding: utf-8 -*- from PyPDF2 import PdfFileReader, PdfFileWriter # PDF文档加密 def demo1(): pdf_reader = PdfFileReader('file/7_4.pdf') pdf_writer =
阅读全文
摘要:# -*- coding: utf-8 -*- # 在pdfplumber模块中 提供了extract_tables()方法 import pdfplumber import pandas as pd # 提取PDF文档中的表格 def demo1(): with pdfplumber.open('
阅读全文
摘要:# -*- coding: utf-8 -*- # 模块的安装与导入 由于pdfplumber和PyPDF2都属于第三方开源模块 因此需要我们额外安装 # 安装 pip install pdfplumber # pip install PyPDF2 import pdfplumber # 提取pdf
阅读全文
摘要:data.xlsx 数据如下 1 # -*- coding: utf-8 -*- 2 # 我们必须进行数据预处理 它直接关系到分析结果的准确性 处理缺失值 数据重复值 3 # 检查缺失值 检测缺失值最简单的方法就是调用info()方法 通过观察每一列的非空值 即可判断出哪些列存在缺失值 4 # an
阅读全文