怎样开始写第一个基于python的selenium脚本
                    
                    
                3 回答
 
                    
                    
                            holdtom
                            
                                
                            
                        
                        
                                                
                    TA贡献1805条经验 获得超10个赞
怎样开始写第一个基于python的selenium脚本
解答如下:
首先打开txt文件,使用open(txtName),进行一行一行的读;
如果需要的话,对每行的数据进行解析;
导入xlrd,xlwt进行excel读写;
大致代码如下:
import xlrd,xlwt
txtName=r"C:\value.txt"
workbook = xlwt.Workbook(encoding = 'ascii')
worksheet = workbook.add_sheet('sheet1')
fp=open(txtName)
for linea in fp.readlines():
worksheet.write(0, 0, label = linea)
workbook.save('Excel_Workbook.xls')
fp.close()
添加回答
举报
0/150
	提交
		取消
	