Python Note_2

1. 文件操作 

 

import os,shutil

#print os.getcwd()


sourceRootFolder="D:\Automation\TestSuites\polaris"

count=0
filecount=0

for f in os.listdir(sourceRootFolder):
	tmpdir=os.path.join(sourceRootFolder, f)
	if f.startswith("T"):
		count=count+1
		newpath=os.path.join(tmpdir,"Scenarios")
		print (newpath)
		for sf in os.listdir(newpath):
			if os.path.isfile(os.path.join(newpath,sf))  and sf.endswith(".xml") :
				filecount=filecount+1


print (count," test suites in total")
print (filecount,"test Scenarios in total")

 

2. 批量修改网页

 

posted on 2016-05-23 19:32  Julie&Julia  阅读(170)  评论(0编辑  收藏  举报