摘要: 对数据: json = json.dumps(data) 编码 dict->string 排序sort_keys=True, 缩进indent=4, 分隔符separators=(',', ': ') json = json.loads(data) 解码 string->dict对文件: json. 阅读全文
posted @ 2018-08-12 15:55 撒欢 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1、运行时加-u参数,如 # python3 -u test.py >> test.log &用man查看python的-u参数,说明如下: Force stdin, stdout and stderr to be totally unbuffered. On systems where it ma 阅读全文
posted @ 2018-08-12 15:54 撒欢 阅读(1270) 评论(0) 推荐(0) 编辑
摘要: >>> word = "Python" >>> word[:2] # character from the beginning to position 2 (excluded)'Py'>>> word[4:] # characters from position 4 (included) to th 阅读全文
posted @ 2018-08-12 15:53 撒欢 阅读(175) 评论(0) 推荐(0) 编辑
摘要: import threading def write_dbs(i): print(i)if __name__ == '__main__': for i in range(7): t = threading.Thread(target=write_dbs, args=(i,)) t.start() 阅读全文
posted @ 2018-08-12 15:39 撒欢 阅读(122) 评论(0) 推荐(0) 编辑
摘要: import threadingimport timeimport datetimedef exec_update(): time.sleep(5)def event_func(): now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:% 阅读全文
posted @ 2018-08-12 15:37 撒欢 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 判断是否存在:db.course.find({"filename": { $exists: true } }).count()移除字段:db.course.update({},{$unset:{"filename":""}},{multi:true})db.test.update({},{$unse 阅读全文
posted @ 2018-08-12 15:21 撒欢 阅读(161) 评论(0) 推荐(0) 编辑
摘要: chkconfig NetworkManager offsystemctl stop NetworkManagersystemctl disable NetworkManager 阅读全文
posted @ 2018-08-12 15:18 撒欢 阅读(6572) 评论(0) 推荐(2) 编辑
摘要: :nohl 可以取消高亮 阅读全文
posted @ 2018-08-12 15:06 撒欢 阅读(1252) 评论(0) 推荐(0) 编辑
摘要: 查看内存:free -h释放内存:echo 3 > /proc/sys/vm/drop_caches 阅读全文
posted @ 2018-08-12 15:05 撒欢 阅读(156) 评论(0) 推荐(0) 编辑