随笔分类 - python
摘要:二维数组中的查找 替换空格从尾到头打印链表重建二叉树 用两个栈实现队列旋转数组的最小数字 斐波那契数列 跳台阶变态跳台阶 矩形覆盖 二进制中1的个数 数值的整数次方 调整数组顺序使奇数位于偶数前面 链表中倒数第k个结点 反转链表 合并两个排序的链表树的子结构...
阅读全文
摘要:from __future__ import division from __future__ import print_function ...
阅读全文
摘要:python2中的字典有has_key方法,python3中删除了if dict.has_key(your_key):改成if your_key in dict:
阅读全文
摘要:python2中的字典有has_key方法,python3中删除了if dict.has_key(your_key):改成if your_key in dict:
阅读全文
摘要:python2 中可以用string.atoi 在python3中会报错替换的方案是string.atoi(your_str)替换为int(your_str)这个代码python2和python3都可以运行.
阅读全文
摘要:python 3.5 安装 mysqlclient 会失败pip install mysqlclient注意这里环境中只有python3.5会出现一大堆红字 编译终止,error: command ‘x86_64-linux-gnu-gcc’ failed ...
阅读全文
摘要:python2 python3 中代码pip install mysqlclient都安装失败的话,很有可能是你的操作系统中没有安装mysql如果确定已经安装了,请忽略下面的内容.Ubuntu 下安装 mysql的方法sudo apt-get -y inst...
阅读全文
摘要:python picklefrom __future__ import absolute_import from __future__ import division from __future__ import print_function ...
阅读全文
摘要:Python2中没有这个问题python3中hashlib.md5(data)函数中data 参数的类型应该是byteshash前必须把数据转换成bytes类型Python 2.7.12 (default, Dec 4 2017, 14:50:18) [G...
阅读全文
摘要:PythonError when calling the metaclass bases Cannot create a consistent method resolution order (MRO) for bases这个异常 看下代码应该是多重继承中类...
阅读全文
摘要:Python 3.5.2 测试可以运行import sys from abc import ABC,abstractme...
阅读全文
摘要:在python3 中会出这个问题,而xrange( )函数时在python 2.x中的一个函数,在Python 3中,range()的实现方式与xrange()函数相同,所以就不存在专用的xrange( )解决方法1. 在python 3 中运行 将xran...
阅读全文
摘要:ImportError: No module named ‘commands’在Python3中执行shell脚本,想要获取其执行状态和标准输出、错误输出的数据,遇到这个错误,原因是commands模块已经被subprocess取代了Deprecated s...
阅读全文
摘要:response.read() returns an instance of bytes while StringIO is an in-memory stream for text only. Use BytesIO instead.The StringI...
阅读全文
摘要:python3import urllib2 import urllib2ImportError: No module named 'urllib2'python3.3里面,用urllib.request 代替 urllib2,所以可以这样兼容python2 ...
阅读全文

浙公网安备 33010602011771号