相似度计算 # 输入A,B两段语句,判断相似度 import jieba from collections import Counter def preprocess_data(text): """数据预处理函数,分词并去除停用词""" # 使用结巴分词对文本进行分词 words = jieba.c Read More
posted @ 2024-02-28 17:33 PythonNew_Mr.Wang Views(1) Comments(0) Diggs(0) Edit
文件/文件夹 - 映射 # django在处理数据库或者媒体文件持久时需要用到 # nginx在读取媒体文件的时候需要用到 1: 移动静态文件(static media db.sqlite3等) 到定义的宿主机路径: /usr/graduation下 -- /usr/graduation/stati Read More
posted @ 2024-01-26 16:38 PythonNew_Mr.Wang Views(4) Comments(0) Diggs(0) Edit
通用分块上传文件 import os # 通用路径分块上传 def piecemeal_public_load(path, original_md5_hash, chunk_index, upload_file, chunk_total, file_Name): """ path: 存放路径(med Read More
posted @ 2024-01-18 11:00 PythonNew_Mr.Wang Views(10) Comments(0) Diggs(0) Edit
获取文件夹下的所有文件名,文件大小,更新时间 import os import datetime def get_files_info(folder_path): files_info = [] # 获取起始路径 base_path = os.path.abspath(folder_path) # Read More
posted @ 2024-01-18 10:56 PythonNew_Mr.Wang Views(5) Comments(0) Diggs(0) Edit
支持中文编码 from zipfile import ZipFile def support_gbk(zip_file): name_to_info = zip_file.NameToInfo # copy map first for name, info in name_to_info.copy( Read More
posted @ 2024-01-18 10:53 PythonNew_Mr.Wang Views(19) Comments(0) Diggs(0) Edit
OpenCv 基础函数 # 读取图片 image = cv2.imread("test01.jpg") # 转灰度 gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # 修改尺寸 resize_image = cv2.resize(image, Read More
posted @ 2023-12-18 10:35 PythonNew_Mr.Wang Views(19) Comments(0) Diggs(0) Edit
算法与库 1. 决策树: - 库: from sklearn.tree import DecisionTreeClassifier(分类树) from sklearn.tree import DecisionTreeRegressor(回归树) - 计算场景:分类和回归问题 2. 逻辑回归: - 库 Read More
posted @ 2023-12-14 17:17 PythonNew_Mr.Wang Views(5) Comments(0) Diggs(0) Edit
协议 gRPC(Google Remote Procedure Call)是一种高性能、开源的远程过程调用(RPC)框架,由Google开发并开源。它基于HTTP/2协议进行通信,使用Protocol Buffers(protobuf)作为接口定义语言(IDL)。 gRPC提供了跨平台、跨语言的服务 Read More
posted @ 2023-12-13 13:59 PythonNew_Mr.Wang Views(17) Comments(0) Diggs(0) Edit
表设计 # 用户表 class UserInfo(models.Model): username = models.CharField(max_length=32,unique=True,verbose_name="用户名") password = models.CharField(max_leng Read More
posted @ 2023-12-08 10:55 PythonNew_Mr.Wang Views(14) Comments(0) Diggs(0) Edit
Django部署 Django Dockerfile FROM python:3.9 ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 WORKDIR /app COPY . /app/XXXXX/ WORKDIR /app/XXXXX/ RU Read More
posted @ 2023-11-20 15:57 PythonNew_Mr.Wang Views(17) Comments(0) Diggs(0) Edit