- 博客(7)
- 收藏
- 关注
原创 python - 读取xml文档生成HTML文档-测试报告
report_xue.xml<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="456" errors="3" failures="28" skip="0"> <testcase classname="test.test_speed" name='中国移动+移...
2019-04-28 15:21:56 1509
原创 python - 数据分片-对列表中的数据进行分片示例
代码:# coding=utf-8import jsonimport sysreload(sys)sys.setdefaultencoding('utf-8')def split_data(to_json, split_num, orgin_data): """ :param to_json: 写入的json文件名称 :param split_num:...
2019-04-26 16:22:24 1965
原创 python - lambda 匿名函数三种等价写法
代码:# coding=utf-8# run函数def run(): print 'This is run!'# 第一种写法(PEP8规范不推荐)func = lambda: run()# 第二种写法def func2(): return run()# 第三种写法def func3(): return run()if __name__ == ...
2019-04-25 18:11:41 354
原创 python -
代码如下:# coding=utf-8def wrap(func): def call_it(*args, **kwargs): """wrap func: call_it""" print('before call') return func(*args, **kwargs) return call_it@wra...
2019-04-25 17:17:29 335
原创 python - functools中update_wrapper的使用,装饰器的使用,lambda的混合使用
代码如下:# coding=utf-8from functools import update_wrappernums = [1, 2, 3, 4, 5, 6]def run(num): """啦啦,我是run函数""" num += 1 print numdef test(): "哈哈,我是test函数" for num in nu...
2019-04-25 17:14:50 1036
原创 shell - shell脚本中的 "#!/bin/sh -x"的含义(调试(-n/-x/-c))
#!/bin/sh -x1. 表明这个脚本是用sh来解析的,因为各种shell的语法还是有细微差别的,比如其他的shell还有bash2.-x 是调试用的,加了这个,就会把脚本中的每条命令的执行情况打印出来以下部分为转载:我们在前面介绍的调试手段是通过修改shell脚本的源代码,从其输出相关的调试信息来定位错误的,那有没有不修改源代码来调试shell脚本的方法呢?有的,那就是使用she...
2019-04-25 13:10:18 8972
原创 python - Queue队列
# coding=utf-8from Queue import Queuefrom threading import Thread, Lock# 创建一个实例queue = Queue()# 遍历列表入队列for i in range(10): queue.put(i) # 入队列 print 'size is :', queue.qsize() # 打印队列...
2019-04-17 22:42:25 194
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人