python 百度自动搜题 问题库在sdsf.txt中
# -*- coding:utf8 -*- import time from selenium import webdriver f = open('sdsf.txt',mode='r',encoding='utf-8') keys=f.readlines() f.close() driver = webdriver.Chrome() def bd(word): driver.get(r'http://www.baidu.com') driver.find_element_by_id("kw").send_keys(word) driver.find_element_by_id("su").click() kk=input("Please enter an key:")#通过输入,是程序暂停 print(kk,word) for i in keys: bd(i)
生命在于运动,智慧在于学习!