
Python
xjtu_qyq
个人的bug与patch持续更新 https://bugs.launchpad.net/~qianyuqiao
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
You are using pip version 8.1.1, however version 20.1.1 is available
参考链接: https://blog.youkuaiyun.com/qq_29935433/article/details/104982952原创 2020-06-21 16:43:22 · 1876 阅读 · 0 评论 -
python __getattr__, __getattribute__,__get__的用法
class C(object): a = 'abc' def __getattribute__(self, *args, **kwargs): print("__getattribute__() is called") return object.__getattribute__(self, *args, **kwargs) def __getattr__...原创 2019-04-23 14:33:33 · 205 阅读 · 0 评论 -
python常用的工具函数
1.zip:接受任意多个(包括0个和1个)序列作为参数,返回一个tuple列表。 如: a = [1,2] b = [3,4] c = dict(zip(a, b)) print c 结果: {1: 3, 2: 4} 2.利用contextlib创建一个上下文管理器 from contextlib import contextmanager @contextmanager de...原创 2019-04-09 23:01:42 · 162 阅读 · 0 评论 -
python查看函数调用栈
我在看开源框架代码的时候,有时候好几天都无法找到一个函数被调用的具体位置。。这个时候就需要记录一下函数调用栈。 源码如下 def Caller(func): def f(*args,**kwargs): import sys from oslo_log import log as logging LOG = logging.getLog...原创 2019-03-04 18:35:50 · 3837 阅读 · 0 评论 -
Python imp模块 实际使用中的坑
关于imp,我开始把他当做了一个简单的import来看 然后我运行下面这段代码,发现了一些奇怪的问题 a.py A = {"position": "in a"} class Test1(object): @classmethod def printA(cls): print "I am in a.py" print A b.py ...原创 2019-01-25 11:16:14 · 2144 阅读 · 2 评论 -
python性能优化的一些建议(一)
参考资料:https://blog.youkuaiyun.com/u010159842/article/details/54573102 1.写python风格的代码 交换两个数 a, b = b, a 2.字符串查找,效率 in > find > 正则表达式, 比如s = "aaaaaccbbbb"中查找"cc", 算法时间 3.数据集遍历,效率dict > set >...原创 2018-10-10 14:34:53 · 151 阅读 · 0 评论