摘要: string1='abcd-1234' print(string1.translate(string1.maketrans('abc','ABC'))) a='aeiou' b='12345' string2='aasdfwe' print(string2.maketrans(a,b)) print(string2.translate(string2.maketrans(a,b))) 阅读全文
posted @ 2016-04-07 17:39 OnePiece! 阅读(299) 评论(0) 推荐(0) 编辑
摘要: import os # 列出当前目录下所有的文件 files = os.listdir(".") print (files) for filename in files: portion = os.path.splitext(filename) # 如果后缀是.txt if portion[1] == ".xls": # 重新组合文件名和后缀名 ... 阅读全文
posted @ 2016-04-07 17:37 OnePiece! 阅读(252) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python #coding=utf-8 #urllib2是python自带的模块,在python3.x中被改为urllib.request import urllib.request import re page = urllib.request.urlopen('http://www.baidu.com') html = page.read().decode('ut... 阅读全文
posted @ 2016-04-07 17:35 OnePiece! 阅读(10538) 评论(0) 推荐(0) 编辑
摘要: #coding=utf-8 import urllib.request import re def getHtml(url): page = urllib.request.urlopen(url) html = page.read() return html def getImg(html): reg = r'src="(.+?\.jpg)" pic_ext'... 阅读全文
posted @ 2016-04-07 17:34 OnePiece! 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/python # -*- coding: utf-8 -*- def bubble_sort(array): length=len(array)-1 for i in range(0,length): for j in range(i,length): if array[i]>array[j+1]: ... 阅读全文
posted @ 2016-04-07 17:33 OnePiece! 阅读(351) 评论(0) 推荐(0) 编辑
摘要: 可以到下载试用版 官网 http://www.telerik.com/teststudio , 装完以后需要装silverlight 安装好了,主界面是介个样子的 点击Record,输入URL,录制脚本。 点击Recorder左下角的Highlight Element,可以定位元素,验证页面信息等 阅读全文
posted @ 2016-04-07 17:20 OnePiece! 阅读(2793) 评论(0) 推荐(1) 编辑
摘要: 打开Eclipse Help ->Install New Software , 然后Add "http://beust.com/eclipse" New ->TestNG ->Create TestNG class , 选择需要的注解 1.单个执行 Run As ->TestNG Test 2.通过 阅读全文
posted @ 2016-04-07 16:14 OnePiece! 阅读(159) 评论(0) 推荐(0) 编辑