python
medusa_zj
这个作者很懒,什么都没留下…
展开
-
python最小二乘法
python最小二乘法#文件名core.pyimport numpy as npdef leastSquare(x,y): if len(x)==2: #此时x为自然序列 sx = 0.5*(x[1]-x[0]+1)*(x[1]+x[0]) ex = sx/(x[1]-x[0]+1) sx2 = ((x[1]*(x[1]+1)*(2*x[1]+1)) -(x[0]*(x[0]-1)*(2*x[0]-1)))/6原创 2021-06-09 10:05:23 · 216 阅读 · 0 评论 -
python画曲线图
python画曲线图一二一import numpy as npimport matplotlib.pyplot as pltimport refrom matplotlib.pyplot import MultipleLocatorinput_txt = 'r3.txt'x = []y = []f = open(input_txt)i=0for line in f: line = line.strip('\n') line = line.split(' ')原创 2021-06-09 10:03:59 · 312 阅读 · 0 评论 -
python文字转为图片
python文字转为图片一、文字横向排列二、文字纵向排列一、文字横向排列#文字横向排列import osfrom io import BytesIOfrom PIL import Image, ImageFont, ImageDrawimport pygameimport randompygame.init()font = pygame.font.Font(os.path.join("fonts", "全新硬笔楷书简.ttf"),22) # 从一个字体文件创建一个 Font 对象 同原创 2021-06-09 09:59:36 · 1637 阅读 · 0 评论 -
python文件重命名
python文件重命名import ospath = "C:\\Users\\Z6000\\Desktop\\文字\\psenet\\数据\\标记\\"# 获取该目录下所有文件,存入列表中f = os.listdir(path)print(len(f))print(f[0])n = 0i = 0j = 19900for i in f: # 设置旧文件名(就是路径+文件名) oldname = f[n] aaa=oldname.split("_")原创 2021-06-09 09:56:21 · 128 阅读 · 0 评论 -
python图片处理
图片处理对图片的处理批量旋转图片图片转换为视频单张图片处理视频存为图片png变为jpg对图片的处理批量旋转图片#-*- coding: UTF-8 -*- from PIL import Imageimport os def get_filelist(path): Filelist = [] for home, dirs, files in os.walk(path): for filename in files: # 文件名列表,包含原创 2021-06-09 09:51:15 · 238 阅读 · 0 评论
分享