随笔分类 - Python
摘要:import numpy as np 1.创建 a = np.array([[0,1],[0,1]]) 2.合并 a =np.array([[1,2],[4,5]]) b =np.array([[9,8],[6,5]]) np.concatenate((a,b)) array([[1, 2,], [
阅读全文
摘要:document:http://effbot.org/imagingbook/pil-index.htm http://pillow.readthedocs.io/en/3.1.x/index.html from PIL import Image 1.打开图片 img = Image.open(fi
阅读全文
摘要:int(x [,base]) 将x转换为一个整数 long(x [,base] ) 将x转换为一个长整数 float(x) 将x转换到一个浮点数 complex(real [,imag]) 创建一个复数 str(x) 将对象 x 转换为字符串 repr(x) 将对象 x 转换为表达式字符串 eval
阅读全文
摘要:1.最近比较喜欢的用法: from concurrent.futures import ProcessPoolExecutor, as_completed ex = ProcessPoolExecutor(max_workers=50) tasks = [ex.submit(process_func
阅读全文
摘要:Github:https://github.com/huangshiyu13/PythonFileLib 1.获得文件夹下所有文件名 for file in os.listdir(imageDir): file_path = os.path.join(imageDir, file) if os.pa
阅读全文
摘要:1.写文件 f = open('out.txt','w') f.write('%s %d %d %d %d 0 0 0 0 0 0 0'%(bbx.name,bbx.x,bbx.y,bbx.w,bbx.h)) f.close() 2.读文件 第一种 f = open("foo.txt") # 返回一
阅读全文