- 博客(8)
- 收藏
- 关注
原创 python小工具:自动解压缩包, cannot find tool 问题
目的解开当前文件夹下的每一个.rar压缩包,各放入同文件名的文件夹下。方法工具python rarfile:主要语法为 rarFile.RARFile(FileName.rar).extractall(path)codeimport rarfileimport osdef unRar(rarFileName): rar = rarfile.RarFile(rarFileName + ".rar") if rarFileName not in os.listdir
2020-09-30 10:59:38 751
原创 python 3D,点成球,螺旋线/面,等高线,莫比乌斯环
点成球import numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3DPC = []x = np.arange(-10,11,1)for i in x: #[1,2]: y = list(np.arange(-np.sqrt(100-i**2),np.sqrt(100-i**2)+1 )) for it in y: PC.append([i,it])
2020-09-22 18:27:47 926
原创 go牛刀小试:切片/递归/接口
slicepackage mainimport "fmt"type Book struct { title string publisher string price int subject string bookID int}func printSlice(x []int) { fmt.Printf("len=%d, cap=%d, slice=%v\n", len(x), cap(x),x)}func main() { fmt.Println("hello!") b
2020-09-20 12:33:58 214
原创 python string和bytes互相转换,去除str(bytes)输出的b‘字眼
b1 = b"i am dady"b2 = b"dady"print('*'*20,'Bytes => String','*'*20)print('将bytes串直接str()输出,带有b\'xx\': ',str(b1),' ',str(b2))print('一种去除b字眼方法,str(x,encoding=\'utf-8\'):',str(b1,encoding='utf-8'), ' ',str(b2,encoding='utf-8'))print('第二种去除b字眼方法,b.d
2020-09-13 11:45:53 22296
原创 Python numpy ndarray加减乘除 矩阵乘 简洁版
#2 numpy + - * / @a = np.arange(0,20).reshape(4,5)b = np.arange(-21,-1).reshape(4,5)[::-1,::-1]c = np.diag([-1,-10,-1000,-100000,-100000000])print(a,b)print('a+ - * / b:',a+b, a-b,a*b,a/b)print('mat multiply: a@c',c, a@c)加减乘除只要都是对ndarray,shape相同,或
2020-09-12 18:06:10 1506
原创 读取采集的特定格式数据
Target: arm上实际采集的数据,byte输出,读取数据并输出来;格式为意义格式大小PPDU_ID1个int324Bmac_id1个int324Bmac_addr1个6字节 hex6Bdata 1 dim数组256长度复数,先实部后虚部都是float16256x4Bimport numpy as npimport binasciiimport matplotlib.pyplot as pltf = open(r'./phone_
2020-09-12 14:38:57 118
原创 numpy的包训练:读写文件、常用函数、random随机数模块和 有用的linalg线性代数模块
import numpy as npimport matplotlib.pyplot as plt'''# 1)numpy readtxt, savetxt 读取和创建txt csv等文件# 2)numpy 常用的函数操作(都是可对数组迭代的,而内建的len(),abs()等只能单元素操作:绝对值fabs,四舍五入、三角-双曲三角、对数指数# 3)np.random random模块的随机操作,生成正态、均匀、泊松的数组random.normal .poisson .uniform;生成排列组合,
2020-09-10 22:28:42 125
原创 时间-日期格式化输出,统计程序时间,统计CPU时间
#Note 时间经常用于创建图形、文件的命名和打标签;一个format的格式事半功倍;#另外,还常用来统计程序运行时间,决定大致算法取舍#1 输出时间格式import time# 年-月-日-时-分-秒print('{0}-{1}-{2}-{3}-{4}-{5}'.format(*time.localtime()))print('%s-%s-%s-%s-%s-%s'%(time.localtime()[0:6]))#第一个*解包,{i}占位;第二个用类似c语言的格式化输出#2 统计时间
2020-09-02 18:48:13 281
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人