随笔分类 -  python学习

python字符串使用
摘要:1.python中的字符数字之间的转换函数 int(x [,base ]) 将x转换为一个整数 long(x [,base ]) 将x转换为一个长整数 float(x ) 将x转换到一个浮点数 complex(real [,imag ]) 创建一个复数 str(x ) 将对象 x 转换为字符串 re 阅读全文

posted @ 2018-10-30 21:30 4c4853 阅读(164) 评论(0) 推荐(0)

Numpy函数
摘要:https://blog.csdn.net/qq351469076/article/details/78817378 阅读全文

posted @ 2018-10-15 20:52 4c4853 阅读(98) 评论(0) 推荐(0)

python几个小用法
摘要:Python split()方法 语法 split() 方法语法: 参数 str -- 分隔符,默认为所有的空字符,包括空格、换行(\n)、制表符(\t)等。 num -- 分割次数。 实例 以下实例展示了split()函数的使用方法: 以上实例输出结果如下: Python List sort()方 阅读全文

posted @ 2018-10-14 15:45 4c4853 阅读(202) 评论(0) 推荐(0)

list assignment index out of range
摘要:现象 m1=[]for i in xrange(n):m1[i]=1 报错:IndexError: list assignment index out of range 分析 空数组不能直接指定位置 解决方法1 m1.append(1) 解决方法2 先生成一个定长的list: m1=[0]*len( 阅读全文

posted @ 2018-10-14 09:00 4c4853 阅读(377) 评论(0) 推荐(0)

Python 中glob模块使用
摘要:1.介绍glob模块用来查找文件目录和文件,常见的两个方法有glob.glob()和glob.iglob(),可以和常用的find功能进行类比,glob支持*?[]这三种通配符 2.三种通配符 *代表0个或多个字符?代表一个字符[]匹配指定范围内的字符,如[0-9]匹配数字 3.例子 output: 阅读全文

posted @ 2018-10-13 10:26 4c4853 阅读(328) 评论(0) 推荐(0)

windows 安装pycocotools
摘要:pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI https://github.com/philferriere/cocoapi 阅读全文

posted @ 2018-10-10 08:51 4c4853 阅读(1313) 评论(0) 推荐(0)

Python中os.mkdir()与os.makedirs()的区别
摘要:一、代码 运行结果: 第一次创建失败!第二次创建成功! 二、分析 os.mkdir() 创建路径中的最后一级目录,即:只创建path_03目录,而如果之前的目录不存在并且也需要创建的话,就会报错。 os.makedirs()创建多层目录,即:Test,path_01,path_02,path_03如 阅读全文

posted @ 2018-09-23 19:32 4c4853 阅读(3969) 评论(0) 推荐(0)

PIL 中的 Image 模块
摘要:转自https://www.cnblogs.com/way_testlife/archive/2011/04/20/2022997.html 里面有两个代码还不错。 创建当前目录下所有以 .jpg 结尾的图片的缩略图 Image 类中的函数 eval : 使用带一个参数的函数作用于给定图片的每一个像 阅读全文

posted @ 2018-09-20 20:19 4c4853 阅读(166) 评论(0) 推荐(0)

Matplotlib使用
摘要:实验中用到了matplotlib,简单记录一下。 使用教程:https://matplotlib.org/users/pyplot_tutorial.html 例子: from matplotlib.font_manager import FontProperties font_set = Font 阅读全文

posted @ 2018-09-20 19:29 4c4853 阅读(150) 评论(0) 推荐(0)

导航