序列包含元组tuple(),字符串str"",列表list[]。 切片的使用模板: S[P1:P2:length] #其中S表示序列,P1表示初始位置(包含P1位置),P2表示结束位置(不包含P2位置),length表示步长 常见几种情况如下: s[::-1] #表示原序列s倒序生成 s[1:6] Read More
posted @ 2018-12-17 13:03
WhiteMouse
Views(388)
Comments(0)
Diggs(0)
示例: 求0-10之间,所有偶数的平方? [x**2 for x in rang(11) if x%2==0] >>> [x**2 for x in range(11) if x%2==0][0, 4, 16, 36, 64, 100] Read More
posted @ 2018-12-17 12:32
WhiteMouse
Views(143)
Comments(0)
Diggs(0)
方法一: with open("e:\\gloryroad.txt","a+",encoding="utf-8") as file: file.write(" "+"\n") print(file.tell()) 备注:使用此方式操作文件,可以不用写close()关闭文件命令,操作完,程序会自动关闭 Read More
posted @ 2018-12-17 12:23
WhiteMouse
Views(186)
Comments(0)
Diggs(0)
file=open("e:\\c.py","w",encoding="utf-8")date=file.close() #关闭文件,一般最后date=file.read() #读取所有内容date=file.readline() #读取一行内容并将光标换行至下一行开始位置date=file.read Read More
posted @ 2018-12-17 12:17
WhiteMouse
Views(213)
Comments(0)
Diggs(0)
文件操作的几种模式: "w" #write ,清空写,生成一个新的文件,写入内容,覆盖原文件"w+" #write and read ,先清空文件,然后写入内容,最后才能读取写入的内容"wb" #write binary #,b表示二进制模式读写"r" #read ,只读"rb" #read bin Read More
posted @ 2018-12-17 12:14
WhiteMouse
Views(647)
Comments(0)
Diggs(0)
re.match(r"a","") #r表示元字符re.match(r"a","abc") #match从字符串起始为匹配,开始匹配则为匹配,否则不匹配re.match(r".","a\nbc") #点.表示匹配任意非\n的字符re.match(r"...","a\nbc") #多个点表示匹配多个连 Read More
posted @ 2018-12-17 12:01
WhiteMouse
Views(132)
Comments(0)
Diggs(0)
正则是测试工程师的一个常用知识重点,特别是在自动化测试(断言)、接口测试(断言)、以及字符串查找、修改、替换等相关操作时: \d #表示数字\D #表示非数字\w #表示数字或字母\W #表示既非数字也非字母\s #表示空白\n \r \t\S #表示非空白\b #表示以空白开头、结尾或非其他字符拼 Read More
posted @ 2018-12-17 11:55
WhiteMouse
Views(2307)
Comments(0)
Diggs(0)
测试鼠和程序猿每天都要对着电脑或手机八九小时以上,甚至十几个小时,长时间对着显示器对眼睛伤害非常大,而且也容易疲劳, 降低工作效率,健康是一切的基础,所以对于长时间用电脑的上班族而言,应该保护好自己的钛金眼,下面是几个简单的步骤: 1、选一张绿色等较柔的图片作为桌面背景。 2、工具或软件一般的默认背 Read More
posted @ 2018-12-17 11:42
WhiteMouse
Views(201)
Comments(0)
Diggs(0)