#

Python

python库 transitions 状态机

python from transitions import Machine class Matter(object): pass lump = Matter() 状态定义 states=['solid', 'liquid', 'gas', 'plasma'] 初始化状态机 machine = Machine(model=lump, s...

Posted by spike on 2024-05-14

#

Python

python 库 box 解析json yaml

python from box import Box movie_data = {"name": "Inception", "director": "Christopher Nolan"} movie = Box(movie_data) print(movie.name) 输出: Inception Inception

Posted by spike on 2024-05-14

#

Python

使用wechat_pyrobot定时采集公众号

插件 [wechat_pyrobot 下载地址}(https://www.123pan.com/s/ihEKVv-XcWx.html) 代码 python import os import json from wechat_pyrobot.msg_plugins import MonitorBiz class MyMonitorBiz(Mon...

Posted by spike on 2024-04-27

#

Python

本地环境使用ollama千问大模型

安装ollama和千问 [ollama官网](https://ollama.com/library/qwen) 通过api调用 python import requests import json url = "http://localhost:11434/api/chat" payload = { "model": "qw...

Posted by spike on 2024-04-06

#

Python

Python nuitka 不同平台统一打包脚本

python import os import platform app_name ='douyin_auto' ico_path ='' output ='output' main ='main.py' system =platform.system) version =platform.release() if system='Windows': ...

Posted by spike on 2024-03-01

#

Python

Python ImageGrab 图像对比 监控屏幕变化

python from PIL import ImageGrab import numpy as np import time import requests Import the requests library def get_screen_region_screenshot(region): """ 获取屏幕指定区域的截图 ...

Posted by spike on 2024-02-15

#

Python

Python fastapi的缓存插件 fastapi-cache2

安装 bash pip install fastapi-cache2 or pip install "fastapi-cache2[redis]" or pip install "fastapi-cache2[memcache]" or pip install "fastapi-cache2[dynamodb]" 使用例子 ...

Posted by spike on 2024-02-15

#

Python

Python mosaic 算法 2

python """ mosaic.py A simple python script that creates a mosaic from an input image. Dependencies: Python Imaging Library, available at http://www.pythonware.com/products/pil/ Summ...

Posted by spike on 2024-02-07

#

Python

Python potrace 位图转矢量图

简介 使用potrace.exe可以把位图转化为svg然后上传到阿里云oss存储。 为什么要使用阿里云的oss存储呢? 因为需要转换的量实在太大了,超过200w张文件,磁盘的存储这么多文件在执行过程中会逐渐卡死,即使时使用的是ssd,故使用阿里云的oss,这样可以缓解磁盘性能引起的程序中断问题。 代码 python import sys im...

Posted by spike on 2024-02-06

#

Python

Python mosaic 算法

python from PIL import Image import os import random 定义瓦片图的尺寸 TILE_SIZE = 32 获取目录下的所有瓦片图 def get_tiles(path): tiles = [] for file in os.listdir(path): file_pat...

Posted by spike on 2024-02-06

Previous Next
Copyright © Your Website 2024
介绍 赞助 Github Rss Sitemap 免责声明 联系