为了账号安全,请及时绑定邮箱和手机立即绑定

请问该怎样开始写第一个基于python的selenium脚本?

请问该怎样开始写第一个基于python的selenium脚本?

拉丁的传说 2019-09-04 11:07:09
怎样开始写第一个基于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()

查看完整回答
反对 回复 2019-09-07
  • 3 回答
  • 0 关注
  • 830 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信