python
海洋2416
这个作者很懒,什么都没留下…
展开
-
numpy
numpy数组# coding=utf-8import numpy as npimport random# 使用numpy生成数组,得到ndarray的类型t1 = np.array([1, 2, 3, ])print("t1:")print(t1)print(type(t1))t2 = np.array(range(10))print("t2:")print(t2)print(type(t2))t3 = np.arange(4, 10, 2)print("t3:")p原创 2021-09-12 13:39:26 · 99 阅读 · 0 评论 -
python 使用protobuf
protobufprotobuf抽象语法syntax = "proto2";package example;message person { required int32 id = 1; required string name = 2;}message all_person { repeated person Per = 1;}import person_pb2# 为 all_person 填充数据pers = person_pb2.all_person()p原创 2021-09-12 13:39:11 · 288 阅读 · 0 评论 -
matplotlib
matplotlib设置坐标轴刻度,设置图片大小,保存图片# coding=utf-8from matplotlib import pyplot as pltx = range(2,26,2)y = [15,13,14.5,17,20,25,26,26,27,22,18,15]#设置图片大小plt.figure(figsize=(20,8),dpi=80)#绘图plt.plot(x,y)#设置x轴的刻度_xtick_labels = [i/2 for i in range(4原创 2021-09-12 10:24:48 · 122 阅读 · 0 评论