python
BugMeOut
这个作者很懒,什么都没留下…
展开
-
python logging 模块
本文转自python的日志logging模块使用总结1.简单的将日志打印到屏幕import logginglogging.debug('This is debug message')logging.info('This is info message')logging.warning('This is warning message')屏幕上打印:WARNING:root:This is war转载 2015-07-09 14:48:41 · 31392 阅读 · 0 评论 -
python编码笔记
编码是最痛苦的事情,python的decode 好像原意是decode ToUnicodeFormat from original Format ,也就是说decode的作用是将str对象变成unicode对象,原来的str是original Format 编码。这人写的不错,有时间读读 http://wklken.me/posts/2013/08/31/python-extra-coding-in原创 2015-07-26 15:49:56 · 31759 阅读 · 0 评论 -
python sh package can't execute in crontab[sh.CommandNotFound]
crontab中,sh.ifconfig()执行不不了,报错类似如下Traceback (most recent call last): File "/home/pi/system/sensor_ip.py", line 7, in <module> LineaX = sh.grep(sh.ifconfig('eth0'), '-oP', '[0-9]{1,3}\.[0-9]{1,3}\原创 2016-08-21 23:37:25 · 31412 阅读 · 0 评论 -
python dict 添加item为dict时,注意temp_dict位置,找问题找了好久。
example1dic_results = {'ret':0,'items':[]}temp_dict = {}for i in xrange(0,10): temp_dict['number'] = i dic_results['items'].append(temp_dict) print dic_results['items']print dic_r原创 2018-01-14 14:07:16 · 32486 阅读 · 1 评论