python
未生无
这个作者很懒,什么都没留下…
展开
-
Python 文件名(文件夹名) 排序
文件夹名 排序如下图,获取Data路径下的文件夹名,并排序具体实现如下: import os ''' 获取 文件夹名 列表 '''path1 = './Data/'file_list = next(os.walk(path1))[1] ''' 文件夹名 排序 '''# 文件夹名 按字符串排序file_list.s...转载 2020-06-26 16:07:56 · 1909 阅读 · 1 评论 -
python numpy 数据类型转换
python numpy 数据类型转换numpy数据类型转换需要调用方法astype(),不能直接修改dtype。调用astype返回数据类型修改后的数据,但是...转载 2020-06-25 15:39:51 · 568 阅读 · 0 评论 -
将MNIST数据集转换成.jpg图片
MNIST数据集简介# MNIST 数据集合共包含70000张手写数字图片# 其中60000张用作训练集# 10...转载 2020-06-22 16:33:39 · 1561 阅读 · 1 评论 -
python+opencv均值滤波,高斯滤波,中值滤波,双边滤波
滤波算法主要包括均值滤波,高斯滤波,中值滤波和双边滤波。 每种算法都有自己的特点,建议从原理上了解每种算法的优缺点。上图给出简洁版的总结。 以下是代码:...转载 2020-05-30 11:36:43 · 348 阅读 · 0 评论 -
python【形态学滤波】——实现开运算、闭运算、形态学梯度、顶帽、黑帽
目录一、几种运算之间的区别与特点二、几种操作的python实现以及效果1、开运算2、闭运算3、形态学梯度4、顶帽5、黑帽三、内核设置cv2.getStructuringElement()一、几种运算之间的区别与特点 运算类型 操作 ...转载 2020-05-30 11:35:37 · 479 阅读 · 0 评论 -
[Leetcode] Perfect Squares 完美平方数
Perfect SquaresGiven a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n = 13, return 2 because 13 = 4 + 9.动态规划复杂度时.转载 2020-05-21 16:49:26 · 305 阅读 · 0 评论 -
python re.match() /单个字符匹配/ 多个字符匹配
1. re模块的使用过程 #coding=utf-8 # 导入re模块 import...转载 2020-04-04 22:05:28 · 10610 阅读 · 0 评论 -
python 字符串补全填充固定长度(补0)的三种方法
'''原字符串左侧对齐, 右侧补零:'''str.ljust(width,'0') input: '789'.ljust(32,'0')output: '78900000000000000000000000000000''''原字符串右侧对齐, 左侧补零:方法一:'''str.rjust(width,'0') input: '798'.rjust(32,'0')outp...转载 2020-04-03 15:52:39 · 3597 阅读 · 0 评论 -
python numpy矩阵中令小于0的元素改为0
>>> import numpy as np>>> a = np.random.randint(-5, 5, (5, 5))>...转载 2020-01-05 20:47:47 · 4112 阅读 · 1 评论