
python
tianhuihui221
就算是每天去上学的路上也会有一块你没踩过的砖。
展开
-
python3使用operator.itemgetter对字典进行排序
operator.itemgetter函数operator模块提供的itemgetter函数用于获取对象的哪些维的数据,参数为一些序号(即需要获取的数据在对象中的序号),下面看例子。a = [1,2,3] >>> b=operator.itemgetter(1) //定义函数b,获取对象的第1个域的值>>> b(a) 2 >>> b=operator.it转载 2017-12-03 15:00:07 · 1845 阅读 · 0 评论 -
python3如何解压缩.rar文件
/********************大部分转载,因为没有成功自己尝试改好后做了修改。原博客地址http://blog.youkuaiyun.com/big_talent/article/details/52367184*********************/第一步安装unrar模块 pip install unrar(怎么用pip就不解释了)然后尝试在转载 2017-11-23 19:02:24 · 14557 阅读 · 2 评论 -
python3解决解压zip文件是文件名乱码问题
在zip标准中,对文件名的 encoding 用的不是 unicode,而可能是各种软件根据系统的默认字符集来采用(此为猜测),因此zipfile中根据文件 flag 检测的时候,只支持 cp437 和 utf-8。具体就是查找 zipfile.py 源代码找到下面的代码: 1: if flags & 0x800:2: # UTF-8 file names extension3原创 2017-11-26 10:25:08 · 6616 阅读 · 5 评论 -
python3的map函数
python的map函数转载 2018-01-03 10:45:29 · 3587 阅读 · 1 评论 -
python的numpy.random详细解析
随机抽样 (numpy.random)简单的随机数据rand(d0, d1, …, dn)随机值>>> np.random.rand(3,2)array([[ 0.14022471, 0.96360618], #random [ 0.37601032, 0.25528411], #random [ 0.49313049, 0.94909878]]) #ran转载 2018-01-03 19:10:17 · 1467 阅读 · 0 评论 -
python3中如何更新界面
from PyQt5.QtCore import QThread , pyqtSignal, QDateTime , QObjectfrom PyQt5.QtWidgets import QApplication, QDialog, QLineEditimport timeimport sysclass BackendThread(QObject): # 通过类成员对象定原创 2018-01-12 18:40:56 · 5289 阅读 · 0 评论 -
python中强制关闭线程方法
import threadingimport timeimport inspectimport ctypesdef _async_raise(tid, exctype): """raises the exception, performs cleanup if needed""" tid = ctypes.c_long(tid) if not inspect.iscl原创 2018-01-12 18:42:33 · 19636 阅读 · 0 评论