随笔分类 -  PYTHON

1 2 3 4 5 ··· 8 下一页
摘要:import os import sys import json import yaml def load_swagger(file_path): with open(file_path, "r", encoding="utf-8") as f: file_ext = os.path.splitex 阅读全文
posted @ 2026-04-03 16:49 NAVYSUMMER 阅读(6) 评论(0) 推荐(0)
摘要:#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 将 Swagger JSON 文件转换为 Word 格式的接口文档 """ import json from docx import Document from docx.shared import 阅读全文
posted @ 2026-04-03 16:40 NAVYSUMMER 阅读(6) 评论(0) 推荐(0)
摘要:1. 安装uv curl -LsSf https://astral.sh/uv/install.sh | sh 2.安装twine和 uv run --python 3.9 -m pip install twine==3.8.0 setuptools==50.0.0 3.上传shell脚本 pack 阅读全文
posted @ 2026-03-19 15:16 NAVYSUMMER 阅读(13) 评论(0) 推荐(0)
摘要:错误原因分析 这个报错的核心含义是:你使用了 license-expression(许可证表达式)这个字段,但它是在 metadata version 2.4 中才被引入的,而你的项目元数据版本还停留在 2.1,版本不兼容导致验证失败。 简单来说,twine 会严格校验项目的 setup.py/py 阅读全文
posted @ 2026-03-19 10:34 NAVYSUMMER 阅读(15) 评论(0) 推荐(0)
摘要:python3: import base64 import hmac import json import logging import random import time import uuid import requests class ExecutableClient: api_server 阅读全文
posted @ 2025-04-09 18:58 NAVYSUMMER 阅读(23) 评论(0) 推荐(0)
摘要:1.创建帐号密码文件,并添加内容 touch /opt/pyserver/.htpasswd echo "username:password" > /opt/pyserver/.htpasswd 2.创建包路径 mkdir /opt/pyserver/packages 3.创建私有仓库 # 不带转发 阅读全文
posted @ 2024-08-11 14:18 NAVYSUMMER 阅读(210) 评论(0) 推荐(0)
摘要:from openpyxl import Workbook from openpyxl.utils import column_index_from_string, get_column_letter # 创建一个Workbook对象 workbook = Workbook() sheet = wo 阅读全文
posted @ 2023-11-15 16:56 NAVYSUMMER 阅读(284) 评论(0) 推荐(0)
摘要:test.py class A: def a(self): pass @staticmethod def b(): pass @classmethod def c(cls): pass @property def d(self): return 1 e = 1 def f(): pass test2 阅读全文
posted @ 2023-10-23 14:42 NAVYSUMMER 阅读(39) 评论(0) 推荐(0)
摘要:1.安装openssl11 yum 安装 openssl 1.1.1k 2.安装依赖 yum install xz-devel zlib-devel bzip2-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make lib 阅读全文
posted @ 2023-08-19 15:20 NAVYSUMMER 阅读(188) 评论(0) 推荐(0)
摘要:class NoModifyMeta(type): def __setattr__(cls, key, value): raise AttributeError(f"Cannot modify class attribute '{key}'") class ConstDict(metaclass=N 阅读全文
posted @ 2023-07-27 23:56 NAVYSUMMER 阅读(120) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- import os import subprocess import threading import time import tkinter from tkinter import TOP, LEFT, RIGHT, messagebox, file 阅读全文
posted @ 2023-07-22 23:54 NAVYSUMMER 阅读(40) 评论(0) 推荐(0)
摘要:import cv2 import subprocess input_video_path = "/home/navy/Desktop/1.mp4" opencv_video_path = "/home/navy/Desktop/2.mp4" new_video_path = "/home/navy 阅读全文
posted @ 2023-07-22 17:16 NAVYSUMMER 阅读(246) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- import os import threading import time import tkinter from tkinter import TOP, LEFT, RIGHT, messagebox, filedialog, DISABLED, 阅读全文
posted @ 2023-07-22 16:10 NAVYSUMMER 阅读(34) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- import os import time import cv2 import numpy from PIL import Image, ImageDraw, ImageFont ascii_char = list("$@B%8&WM#*oahkbdp 阅读全文
posted @ 2023-07-22 15:04 NAVYSUMMER 阅读(39) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- import os import threading import tkinter from tkinter import LEFT, RIGHT, filedialog, messagebox, DISABLED, NORMAL, TOP impor 阅读全文
posted @ 2023-07-22 03:53 NAVYSUMMER 阅读(34) 评论(0) 推荐(0)
摘要:1.安装 pip3 install -U lesscode_tool 2.创建项目(目前仅支持创建lesscode-py,其他项目请用subcommand实现) 2.1创建lesscode-py项目 lesscodeTool new -d test 2.2创建django项目 lesscodeToo 阅读全文
posted @ 2023-05-03 21:58 NAVYSUMMER 阅读(48) 评论(0) 推荐(0)
摘要:import re def to_camel_case(x): """转驼峰法命名""" return re.sub('_([a-zA-Z])', lambda m: (m.group(1).upper()), x) def to_upper_camel_case(x): """转大驼峰法命名""" 阅读全文
posted @ 2023-05-02 20:07 NAVYSUMMER 阅读(250) 评论(0) 推荐(0)
摘要:# 不带密码认证的 docker run --name pypi --restart always -p 8080:8080 -d pypiserver/pypiserver -P . -a . # 带密码认证的 docker run --name pypi --restart always -v 阅读全文
posted @ 2023-04-11 22:47 NAVYSUMMER 阅读(195) 评论(0) 推荐(0)
摘要:def es_mapping2dict(mapping): mapping_dict = dict() if isinstance(mapping, dict): if "properties" in mapping: for k, v in mapping.get("properties").it 阅读全文
posted @ 2023-04-08 01:30 NAVYSUMMER 阅读(16) 评论(0) 推荐(0)
摘要:def data2single_dict(source): stack = [(source, "")] result = {} while stack: obj, parent_name = stack.pop() if isinstance(obj, dict): for k, v in obj 阅读全文
posted @ 2023-04-08 00:31 NAVYSUMMER 阅读(17) 评论(0) 推荐(0)

1 2 3 4 5 ··· 8 下一页
交流群 编程书籍