随笔分类 - Python
脚本编程语言
摘要:图片转base64 def IconToBase64(self, UIPhoto): with open(UIPhoto, 'rb') as image_file: base64_string = base64.b64encode(image_file.read()).decode('utf-8')
阅读全文
摘要:import os import zipfile import xml.etree.ElementTree as ET from openpyxl import load_workbook from PIL import Image import shutil def extract_excel_i
阅读全文
摘要:获取yaml文件内容存储为Execl import yaml import pandas as pd def yaml_to_excel(yaml_file, excel_file): # 读取YAML文件 with open(yaml_file, 'r', encoding='utf-8') as
阅读全文
摘要:import os from openpyxl import Workbook from openpyxl.drawing.image import Image from openpyxl.utils import get_column_letter def insert_images_to_exc
阅读全文
摘要:import os from PIL import Image import sys def convert_folder_to_ico(input_folder, output_folder=None, sizes=None): """ 批量转换文件夹内的图片为ICO Args: input_fo
阅读全文
摘要:创建setUp.py from cx_Freeze import setup, Executable setup( name = "AppName", version = "0.1", description = "Your application description", executables
阅读全文
摘要:基础
阅读全文
摘要:虚拟环境的安装及使用
阅读全文
摘要:现代、快速(高性能)的 Web 框架,用于构建基于 Python 的 API;基于 Starlette 和 Pydantic 库构建而成 官网:https://fastapi.tiangolo.com/ 1、安装 # 对于生产环境,还需要一个ASGI服务器,如Uvicorn或Hypercorn #
阅读全文
摘要:定义 递归是一种解决问题的有效方法,在递归过程中,函数将自身作为子例程调用。 思想 函数调用函数本身,直到不能调用为止 注意事项 基本情况用于保证程序调用及时返回,不在继续递归,保证了程序可终止。 递推关系,可将所有其他情况拆分到基本案例。 递推关系: 一个问题的结果与其子问题的结果之间的关系。
阅读全文
摘要:特殊符号处理 # coding:utf-8 import os class make_folder: @staticmethod def __special_symbol_processing(folder_name): """目录名称中的特殊符号处理""" char_list = ['*', '|
阅读全文
摘要:字符串、datetime、date 日期格式转换
阅读全文
摘要:calendar 日历模块
阅读全文
摘要:方法一:绝对值 if __name__ == "__main__": """run""" print("负数取反-绝对值:{}".format(abs(-28))) print("正数数取反-绝对值:{}".format(abs(32) * -1)) 结果: 方法二:numpy库 # coding:
阅读全文
摘要:查询当前日期的所在月的天数 # coding:utf-8 import datetime import calendar from loguru import logger as logs class ca: @staticmethod def days_of_the_month(): """查询当
阅读全文
摘要:auto-py-to-exe 图形化程序打包 安装 pip install auto-py-to-exe 执行 # 命令行输入 auto-py-to-exe 图形界面 < 选择好python文件之后点击convert .py to .exe 就可以进行打包了>
阅读全文
摘要:python 操作redis数据库
阅读全文
摘要:HMAC算法可以用于验证信息的完整性,这些信息可能在应用之间或者网络间传递 1、SHA加密 # -*- coding:utf-8 -*- import hmac import hashlib class hmac_tools: def __init__(self): self.key = "a123
阅读全文
浙公网安备 33010602011771号