
python
someonelikesyou
这个作者很懒,什么都没留下…
展开
-
Python:ufunc ‘subtract‘ did not contain a loop with signature matching types dtype(‘「U32‘)
python报错ufunc 'subtract' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')前面有个warning:FutureWarning: Beginning in version 0.22, arrays of bytes/strings will be converted to decimal numbers if dtype='.原创 2020-07-02 20:34:30 · 6801 阅读 · 2 评论 -
Python 代码性能优化技巧
https://www.ibm.com/developerworks/cn/linux/l-cn-python-optim/目录:Python 代码优化常见技巧 1. 数据结构-使用字典 (dictionary) 还是列表 (list) 2. 数据结构-使用集合 (set) 还是列表 (list) 3. 对循环的优化 4.充分利用 Lazy if-evaluation 的特性 5.字符串的优化 6.使用列表解析(list comprehension)和生成器表达式(...转载 2020-06-30 16:06:07 · 125 阅读 · 0 评论 -
python编码错误处理
如题,同时解决UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 4: invalid continuation byte问题。b = b'\u7cfb\u7edf\u627e\u4e0d\u5230\u6307\u5b9a\u7684\u8def\u5f84'#decode()默认值为'utf-8'...原创 2020-04-21 20:09:10 · 2322 阅读 · 0 评论 -
解决python ImportError: Failed to import any qt binding
问题:如题。解决方法:1. 重新安装,或降低版本matplotlib#重新安装python -m pip uninstall matplotlibpython -m pip install --upgrade pippython -m pip install matplotlib#降低版本python -m pip uninstall matplotlibpython ...原创 2020-03-20 13:12:30 · 14169 阅读 · 3 评论 -
Python startswith()如何判断字符串开头为空; split('\n')
想什么呢!为空的字符串为什么要判断第一个字符!真实越学越傻。。。应该先判断是否为空呀!# 判断一个字符串不空且不以#开头if str: if not str.startswith('#'): print(str)另外说下,关于用spilt('\n'):#如果从文件读入数据,用'\n'with open(File_Path) as file_objec...原创 2020-01-07 18:24:39 · 1298 阅读 · 0 评论 -
Python zip()函数使用及常见报错处理
zip用法zip即将多个可迭代对象组合为一个可迭代的对象,每次组合时都取出对应顺序的对象元素组合为元组,直到最少的对象中元素全部被组合,剩余的其他对象中未被组合的元素将被舍弃。keys = ['one', 'two', 'three', 'four']values = [1, 2, 3]d = zip(keys, values)print(d)#<zip object a...原创 2019-11-23 14:05:32 · 1398 阅读 · 1 评论 -
关于python pickle模块用法与常见报错
pickle模块用法 转自https://www.cnblogs.com/lincappu/p/8296078.html用于序列化的两个模块 json:用于字符串和Python数据类型间进行转换 pickle: 用于python特有的类型和python的数据类型间进行转换 json提供四个功能:dumps,dump,loads,load pickle提供四个功能:dum...转载 2019-11-18 23:50:50 · 2849 阅读 · 0 评论 -
win10安装配置anaconda+mingw+theano+keras及报错处理
1. 卸载原有python 否则可能会遇到各种奇奇怪怪的问题,比如conda install mingw libpython时报错“TypeError: LoadLibrary() argument 1 must be str, not None”。2.下载anaconda 我用的版本:Anaconda3-2019.03-Windows-x86_64。...原创 2019-08-24 17:08:04 · 1882 阅读 · 0 评论