03 2017 档案

摘要:将路径和文件名分开:os.path.split() 分2中路径: 1.path='/abc/test/' import os os.path.split(path),得到元组('/abc/test','') 2.path='/abc/test' import os os.path.split(pat 阅读全文
posted @ 2017-03-31 17:41 水工 阅读(3347) 评论(0) 推荐(1) 编辑
摘要:1.表达式 for x in xx 如,list=[1,2,3,4,5]每项加1,得到新的列表 print([i+1 for i in list]) 2.表达式 for x in xx if语句 如,list=[1,2,3,4,5]对表现大于3的加1,得到新的列表 print([i+1 for i 阅读全文
posted @ 2017-03-30 13:46 水工 阅读(132) 评论(0) 推荐(0) 编辑
摘要:1.集合中元素是无序不重复的 2.可变集合定义set();不可变集合定义frozenset() 3.可变集合操作元素方法:add(),update(),remove() 4.集合定义,s=set(参数),参数可以为字符串、列表、字典(为字典时,得到的集合是字典键); 也可以直接定义,如s={1,'a 阅读全文
posted @ 2017-03-30 13:40 水工 阅读(180) 评论(0) 推荐(0) 编辑
摘要:1.创建test.py文件,如输入2个命令行参数,求和 #! python3 (windows下要加这行,但我没加也没报错) import sysa=sys.argv[1] #sys.argv列表的第一项(sys.argv[0])是文件名字符串,第二项是第一个命令行参数b=sys.argv[2] # 阅读全文
posted @ 2017-03-28 17:23 水工 阅读(4898) 评论(0) 推荐(0) 编辑
摘要:def f(x): return x*x a=map(f,[1,2,3])print(type(a)) #a的类型为mapb=map(lambda x:x*x,[1,2,3])print(list(b)) reduce(),对对象(列表,元组等)中的所有元素进行操作(先对第1、2个元素进行操作,得到 阅读全文
posted @ 2017-03-26 12:13 水工 阅读(264) 评论(0) 推荐(0) 编辑
摘要:windows下: 1.下载openpyxl,http://pypi.doubanio.com/simple/openpyxl/ 2.将python根目录和/Scripts目录添加到环境变量PATH 3.cmd进入openpyxl解压文件夹,执行 pip install openpyxl 4.确认是 阅读全文
posted @ 2017-03-24 11:24 水工 阅读(23166) 评论(0) 推荐(0) 编辑
摘要:js弹框: 点击【确定】按钮,driver.switch_to_alert().accept() 点击【取消】按钮,driver.switch_to_alert().dismiss() 阅读全文
posted @ 2017-03-17 14:13 水工 阅读(2727) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示