![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
风尘仆
这个作者很懒,什么都没留下…
展开
-
2021-09-07: python对中文名称重排序
对中文名称重排序import functoolsdef cmp_str(s1, s2): pos1 = s1.find('-') pos2 = s2.find('-') i1 = int(s1[:pos1]) i2 = int(s2[:pos2]) if i1 < i2: return -1 if i1 > i2: return 1 return 0with open('E:\\vidlist.t原创 2021-09-07 23:52:29 · 183 阅读 · 0 评论 -
使用pdb调试python代码
1.10分钟教程掌握Python调试器pdbhttps://www.jianshu.com/p/53cd688185af2.Python ipdb 调试大法https://zhuanlan.zhihu.com/p/368109783.pdb--- Python 的调试器https://docs.python.org/zh-cn/3/library/pdb.html4.python调试:pdb基本用法(转)https://www.jianshu.com/p/fb...原创 2021-01-19 22:20:22 · 332 阅读 · 0 评论 -
使用vscode对python代码格式化
1.VS Code:Python代码过长导致格式化时自动换行?https://www.jianshu.com/p/dfa4c2ce71d62.解决vscode无法写入用户配置https://www.aityp.com/%E8%A7%A3%E5%86%B3vscode%E6%97%A0%E6%B3%95%E5%86%99%E5%85%A5%E7%94%A8%E6%88%B7%E9%85%8D%E7%BD%AE/3.vscode写python调用autopep8自动格式化代码把...原创 2021-01-19 21:56:58 · 10428 阅读 · 0 评论 -
在python中比较两个float数据
https://blog.csdn.net/qq_35462323/article/details/90638603原创 2021-01-19 14:54:01 · 1227 阅读 · 0 评论 -
Python3.6通过使用ctypes库调用自己编写的C++函数
1、编写C++头文件及源代码。2、使用cmake打包测试无问题。3、添加关键字“extern C”。有必要的话修改C++函数参数类型。4、编写python程序调用from ctypes import *infile = "./ball_vicon_09041823.txt".encode('utf-8')outfile = "./ball_vicon_fixed_09041825.txt".encode('utf-8')vdtpcs = cdll.LoadLibrary('./b原创 2020-09-09 23:46:00 · 441 阅读 · 0 评论 -
could not find or load the Qt platform plugin “xcb“ in ““.
问题描述:在conda环境下使用mayavi一直出现报错。开始是vtk版本的报错,后来多次更换版本安装以后报错不变。看到网上博客有建议重新安装pyqt5,使用conda卸载时发现这个包是pip安装源的。于是使用pip卸载,使用conda在conda源下重新安装qt、pyqt,发现报错依旧。解决办法:查找多篇博客后发现原因在于在“/home/user/.conda/envs/3dvision/lib/python3.6/site-packages/PyQt5/Qt/plugins/pla.原创 2020-09-06 18:53:31 · 626 阅读 · 1 评论 -
数据处理知识总结
1.如何对python中的list中所有元素进行类型转换?# helper function to type cast list 使用map操作def cast_list(test_list, data_type): return list(map(data_type, test_list)) # helper function to type cast Matrix 使用lambda函数def cast_matrix(test_matrix, data_type...原创 2020-09-02 22:39:04 · 367 阅读 · 0 评论 -
使用mayavi进行三维数据可视化
import numpy as npfrom mayavi import mlabimport pandas as pddf=pd.read_csv('~/vicon/nexusdata.csv',header=3)#ball1col_X1 = df['X1'][1:2000].tolist()col_Y1 = df['Y1'][1:2000].tolist()col_Z1 = df['Z1'][1:2000].tolist()pos_X1 = list(map(f...原创 2020-09-02 21:59:14 · 1128 阅读 · 0 评论 -
numpy.random使用
numpy.random.normal (loc = 0.0, = 1.0, = None)大小¶从正态(高斯)分布中抽取随机样本。正态分布的概率密度函数,最初由德莫夫尔推导,200年后由高斯和拉普拉斯分别推导,由于其特征形状,常被称为钟形曲线(见下例)。自然界中经常出现正态分布。例如,它描述了受大量微小、随机扰动影响的常见样本分布,每个扰动都有其独特的分布[2]。请注意新代码应该使用default_rng()实例的常规方法;看到random-quick-start。参数浮点数的loc原创 2020-07-27 20:09:02 · 498 阅读 · 0 评论 -
jupyter notebook添加kernel
//通过命令 python2、python3 安装不同的环境()$python2 -m ipykernel install --user$python2 -m ipykernel install --user --name 2.7env --display-name "Python (2.7env)"$jupyter notebook$python3 -m ipykernel install --user$python3 -m ipykernel install --user --.原创 2020-07-12 20:26:59 · 239 阅读 · 0 评论 -
python限制操作执行时间
Linux下:使用 timeout Ns(N是执行的秒数)命令。timeout 3s op_statement_do_somthing.Python中使用os.sysytem('timeout 3s op_statement_do_somthing.')其他方法(仅限Linux):https://stackoverflow.com/questions/52779920/why-is-signal-sigalrm-not-working-in-python-on-window..原创 2020-06-02 22:34:21 · 761 阅读 · 0 评论 -
Anaconda环境管理笔记
管理包安装了 Anaconda 之后,管理包是相当简单的。要安装包,请在终端中键入condainstall package_name。例如,要安装 numpy,请键入condainstall numpy。你还可以同时安装多个包。类似condainstall numpy scipy pandas的命令会同时安装所有这些包。还可以通过添加版本号(例如condainstall ...原创 2020-04-04 12:55:21 · 200 阅读 · 0 评论 -
pycharm.2019.03.03-专业版激活
http://idea.medeming.com/jets/一次不成功可以多尝试几次。2020年03月14日试验使用可至2021/02/18原创 2020-03-14 21:21:59 · 2076 阅读 · 2 评论 -
Python Strings用法
0.在线参考资料: 0.1-http://thepythonguru.com/python-strings/1. chr()chr(i)Return the string representing a character whose Unicode code point is the integeri. For example, chr(原创 2016-12-12 13:16:51 · 1366 阅读 · 0 评论 -
numpy中的split方法
numpy.array_split注:切分array是按照从左至右的顺序切分,不是随机切分!numpy.array_split(ary,indices_or_sections, axis=0)[source]Split an array into multiple sub-arrays.Please refer to the split documentation. The原创 2016-12-26 11:08:58 · 17749 阅读 · 0 评论 -
matplotlib-设置绘图横纵坐标的取值范围
axes = plt.gca()axes.set_xlim([xmin,xmax])axes.set_ylim([ymin,ymax])设置纵坐标范围:原创 2017-04-18 18:49:10 · 27798 阅读 · 0 评论 -
local variable 'bug_cnt' referenced before assignment
原代码:bug_cnt=0def foo(): for i in range(10): bug_cnt = bug_cnt+1 if __name__ == '__main__': foo() print bug_cnt运行出现“local variable 'bug_cnt' referenced before assignment”错误。bu原创 2017-08-16 21:01:39 · 1235 阅读 · 0 评论 -
anaconda--配置pip
1、在合适的系统寻找合适的环境配置文件。不存在的话需要自己新建一个。ConfigurationConfig filepip allows you to set all command line option defaults in a standard inistyle config file.The names and locations of the configura原创 2017-11-07 09:59:32 · 2676 阅读 · 0 评论 -
Original error was: libopenblasp-r0-39a31c03.2.18.so: cannot open shared object file: No such file o
参考:https://github.com/conda/conda/issues/5969NumesSanguis commented on 21 Sep • edited Same problem here, I could only solve it with (on Ubuntu 16.04):conda insta转载 2017-12-27 11:21:20 · 3992 阅读 · 3 评论 -
Python借助os.system,subprocess.call()函数调用系统命令
Python System CommandWhile making a program in python, you may need to exeucte some shell commands for your program. For example, if you usePycharmIDE, you may notice that there is option to s翻译 2018-01-15 15:40:16 · 5902 阅读 · 0 评论 -
Python中的os.walk
os.walk(top,topdown = True,onerror = None,followlinks = False) 通过自顶向下或自底向上走树来生成目录树中的文件名。对于根目录顶部(包括顶部本身)树中的每个目录,它产生一个3元组(dirpath,dirnames,filenames)。 dirpath是一个字符串,即目录的路径。 dirnames是dirpath中子目录的名称原创 2018-01-19 17:09:35 · 872 阅读 · 0 评论 -
Python FAQs
1.int->char & char ->intchr(i)¶Return the string representing a character whose Unicode code point is the integer i. For example, chr(97) returns the string 'a', while chr(8364) returns th原创 2016-08-23 20:58:54 · 328 阅读 · 0 评论