Python 如何使用循环迭代电子表格的特定列,并将结果值保存在下一列中
如图所示。我想使用webdriver选择一个google搜索url,在google.com中启动此url,选择结果计数并将其插入url前面的下一列。我正在正确连接、打开和启动第一个url,但我想运行所有url,并将值放在电子表格的一列中,在一个单步循环中。给定的是代码读取的第一个url,请帮助Python 如何使用循环迭代电子表格的特定列,并将结果值保存在下一列中,python,selenium,selenium-webdriver,google-sheets,Python,Selenium,Selenium Webdriver,Google Sheets,如图所示。我想使用webdriver选择一个google搜索url,在google.com中启动此url,选择结果计数并将其插入url前面的下一列。我正在正确连接、打开和启动第一个url,但我想运行所有url,并将值放在电子表格的一列中,在一个单步循环中。给定的是代码读取的第一个url,请帮助 scope = ['https://spreadsheets.google.com/feeds'] creds = ServiceAccountCredentials.from_json_keyfile
scope = ['https://spreadsheets.google.com/feeds']
creds =
ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread.authorize(creds)
sheet = client.open("Popular Searches - Warmup").sheet1
ellData=str(sheet.cell(1,2))
print cellData
firstUrl = re.search("(?P<url>https?://[^\s]+)", cellData).group("url")
print "\nUrl is : " + firstUrl
driver=webdriver.Firefox()
driver.get(firstUrl)
scope=[]https://spreadsheets.google.com/feeds']
信誉=
ServiceAccountCredentials.from_json_keyfile_name('client_secret.json',scope)
client=gspread.authorize(creds)
sheet=client.open(“热门搜索-预热”)。sheet1
ellData=str(表单元格(1,2))
打印单元格数据
firstUrl=re.search((?Phttps?:/[^\s]+)”,cellData.group(“url”)
打印“\nUrl为:”+firstUrl
driver=webdriver.Firefox()
获取驱动程序(firstUrl)
您可能会更好地使用谷歌工作表的API:已经使用bro这就是为什么我能够连接到谷歌电子表格您可能会更好地使用谷歌工作表的API:已经使用bro这就是为什么我能够连接到谷歌电子表格