代码改变世界

随笔档案-2018年01月

json dumps的参数理解

2018-01-18 10:15 by 龙武大帝, 6701 阅读, 收藏,
摘要: Skipkeys:默认值是False,如果dict的keys内的数据不是python的基本类型(str,unicode,int,long,float,bool,None),设置为False时,就会报TypeError的错误。此时设置成True,则会跳过这类key ensure_ascii:默认值Tr 阅读全文

re 模块学习

2018-01-02 10:39 by 龙武大帝, 234 阅读, 收藏,
摘要: 2、re.findall() & re.split() 3、re.sub() 4、其他 阅读全文

python logging 模块

2018-01-01 19:18 by 龙武大帝, 199 阅读, 收藏,
摘要: 1、最简单用法 很多程序都有记录日志的需求,并且日志中包含的信息即有正常的程序访问日志,还可能有错误、警告等信息输出,python的logging模块提供了标准的日志接口,你可以通过它存储各种格式的日志,logging的日志可以分为 debug(), info(), warning(), error 阅读全文

python 模块学习

2018-01-01 16:29 by 龙武大帝, 190 阅读, 收藏,
摘要: 1、time time.time() #时间戳 time.gmtime() #国际UTC时间struct_time time.localtime() #本地中国时间UTC+8 struct_time time.mktime(time.gmtime()) #将struct_time转换成时间戳 tim 阅读全文