随笔分类 - my-python
摘要:clog python 多进程 logging:ConcurrentLogHandler
阅读全文
摘要:https://docs.aws.amazon.com/general/latest/gr/signature-version-2.html
阅读全文
摘要:运行出现如下错误 uncode编码警告:在unicode等价比较中,把两个参数同时转换为unicode编码失败。中断并认为他们不相等。 windows下的字符串str默认编码是ascii,而python编码是utf8 解决方法:添加如下几行代码 import sys reload(sys) sys.
阅读全文
摘要:报错 你 result 返回的是 None ,所以 result [0] 取不了值
阅读全文
摘要:有时需要访问某个接口,其中传入的整形参数可能比较长就会变成long,这时如果用str()的话‘L’就会被转化到字符串中,导致接口不能识别; 这种情况下应该优先使用json来转译,可以完美保持翻译python的语法,如下所示:
阅读全文
摘要:A way to get a handle to the current running module in Python: import sys module = sys.modules[__name__] it really only works if you are doing the who
阅读全文
摘要:Q:python模块中的相对导入,绝对导入,有些地方会写 from __future__ import absolute_import 希望有个更详细的讲解。 A: 关于这句from __future__ import absolute_import的作用: 直观地看就是说”加入绝对引入这个新特性”
阅读全文
摘要:# 迭代器,具有__next__方法,并逐一向后取值li = [11,22,33]obj = iter(li)obj.__next__()# 可迭代对象,具有__iter__方法,返回迭代器li = list([11,22,33])迭代器 = li.__iter__()# 生成器,函数中具有yiel
阅读全文
摘要:如果不用本文指定的方法,会有如下报错: UnicodeDecodeError: 'utf8' codec can't decode byte 0xbf in position 2: invalid start byte 解决方法: import json print json.dumps(mail_
阅读全文
摘要:python logging模块可能会令人困惑的地方 通过参阅python logging模块的代码,发现一些有趣的现象: 1. logging对象其实是一个树形结构,每个创建的logging对象都是root logging对象的孩子结点。当使用logging模块的getLogger(name=No
阅读全文

浙公网安备 33010602011771号