随笔分类 -  python

摘要:Python assert(断言)用于判断一个表达式,在表达式条件为 false 的时候触发异常。 阅读全文
posted @ 2022-03-14 10:13 Tomorrow1126 阅读(76) 评论(0) 推荐(0) 编辑
摘要:https://www.runoob.com/python/att-string-format.html print('{} {}'.format("name","gender")) print("网站名:{name}, 地址 {url}".format(name="菜鸟教程", url="www. 阅读全文
posted @ 2022-03-09 11:02 Tomorrow1126 阅读(25) 评论(0) 推荐(0) 编辑
摘要:correct+=(predicted==labels).sum() 一、Python自带sum() sum(iterable[, start]):iterable——可迭代对象,如:list、tuple、set等;start——固定相加的参数,默认为0。 sum([0, 1, 2]) -- > 3 阅读全文
posted @ 2022-03-09 10:49 Tomorrow1126 阅读(674) 评论(0) 推荐(0) 编辑
摘要:size()函数主要是用来统计矩阵元素个数,或矩阵某一维上的元素个数的函数。 参数numpy.size(a, axis=None)a:输入的矩阵axis:int型的可选参数,指定返回哪一维的元素个数。当没有指定时,返回整个矩阵的元素个数。 >>> a = np.array([[1,2,3],[4,5 阅读全文
posted @ 2022-03-09 10:27 Tomorrow1126 阅读(816) 评论(0) 推荐(0) 编辑
摘要:numpy中reshape函数的三种常见相关用法 reshape(1,-1)转化成1行: reshape(2,-1)转换成两行: reshape(-1,1)转换成1列: reshape(-1,2)转化成两列 数组新的shape属性应该要与原来的配套,如果等于-1的话,那么Numpy会根据剩下的维度计 阅读全文
posted @ 2022-03-08 19:32 Tomorrow1126 阅读(833) 评论(0) 推荐(0) 编辑
摘要:用于将一个可遍历的数据对象(如列表、元组或字符串)组合为一个索引序列,同时列出数据和数据下标,一般用在 for 循环当中。 举例: 阅读全文
posted @ 2022-03-08 16:09 Tomorrow1126 阅读(45) 评论(0) 推荐(0) 编辑
摘要:注释和代码同一行的,需要离代码至少两个空格,井号后加一个空格再写注释 阅读全文
posted @ 2022-03-08 10:23 Tomorrow1126 阅读(149) 评论(0) 推荐(0) 编辑
摘要:shutil 是高级的文件,文件夹,压缩包处理模块。 https://zhuanlan.zhihu.com/p/37409935 阅读全文
posted @ 2022-03-02 15:00 Tomorrow1126 阅读(20) 评论(0) 推荐(0) 编辑
摘要:图片转视频的命令如下: $ ffmpeg -r 25 -i img001.jpg -vcodec libx264 -pix_fmt yuv420p one_img_to_video.mp4 ... [libx264 @ 0x7faf5b809200] i8c dc,h,v,p: 65% 19% 9% 阅读全文
posted @ 2022-03-02 13:40 Tomorrow1126 阅读(588) 评论(0) 推荐(0) 编辑
摘要:os模块中的os.path.exists()方法用于检验文件是否存在。 判断文件是否存在 import os os.path.exists(test_file.txt) #True os.path.exists(no_exist_file.txt) #False 判断文件夹是否存在 import o 阅读全文
posted @ 2022-03-01 17:40 Tomorrow1126 阅读(105) 评论(0) 推荐(0) 编辑
摘要:import time start=time.time() end=time.time() print(end-start) 阅读全文
posted @ 2022-02-22 20:11 Tomorrow1126 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2022-01-29 16:31 Tomorrow1126 阅读(25) 评论(0) 推荐(0) 编辑
摘要:numpy.prod(a, axis=None, dtype=None, out=None, keepdims=) axis为1表示一行的元素相乘 阅读全文
posted @ 2022-01-29 11:42 Tomorrow1126 阅读(159) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示