随笔分类 - 自动化办公
自动化办公随笔
摘要:import time import pandas as pd import pyautogui import pyperclip data = pd.read_excel("file/社群优质用户奖励发放.xlsx", header=0) person_pass = [] for index, r
阅读全文
摘要:# -*- coding: utf-8 -*- import time from pyautogui import * def demo1(): time.sleep(2) # 控制键盘发送文本 write('hello world', interval=0.01) print('') time.s
阅读全文
摘要:# -*- coding: utf-8 -*- import pyautogui import os file_url = os.getcwd() + '/file/img.png' # 屏幕截图 def demo1(): pyautogui.screenshot(region=(0, 0, 192
阅读全文
摘要:# -*- coding: utf-8 -*- # 利用pyautogui模块实现鼠标移动 单击 拖动 滚动 等操作 import time import pyautogui # 移动鼠标 def demo1(): # duration=1 移动时间持续1秒 pyautogui.moveTo(100
阅读全文
摘要:# -*- 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()
阅读全文