Python 如何以倍数更改列表的索引
我正在为一个项目创建一个网络爬虫。下面脚本的输出将放入SQL数据库。我想知道的是,如何将第26行的列表索引更改为9Python 如何以倍数更改列表的索引,python,sql,selenium-webdriver,Python,Sql,Selenium Webdriver,我正在为一个项目创建一个网络爬虫。下面脚本的输出将放入SQL数据库。我想知道的是,如何将第26行的列表索引更改为9 from selenium import webdriver as wd from selenium.webdriver.chrome.options import Options as Op import csv import mysql.connector url = ['https://craz.ca/monitoring/calgary-central/', 'h
from selenium import webdriver as wd
from selenium.webdriver.chrome.options
import Options as Op
import csv
import mysql.connector
url = ['https://craz.ca/monitoring/calgary-central/', 'https://craz.ca/monitoring/calgary-
southeast/', 'https://craz.ca/monitoring/calgary-northwest/']
def ce():
urlce = url[0]
ce_options = Op()
#Add arguments here - if the server runs on windows
#and here if the serve runs on linux
#and here - if you want to not open a chrome window
ce_driver = wd.Chrome(options=ce_options)
ce_driver.get(urlce)
jsv_ce = ce_driver.find_element_by_link_text("Tabular Data")
jsv_ce.click()
#this is the list
ce_data = ce_driver.find_elements_by_xpath("""//*[@id="tableDisplay"]/table/tbody/tr/td""")
for i in ce_data:
#x = 9
#dtime = 0
#dtime += x
print(ce_data[27].text)
ce()
我正在抓取的网站上的表有一个表,其中有九列。网站URL在这里:我们看不到行号,第26行也没有您发布内容的列表。请在你的问题文本中指出你所指的代码,我们看不到行号,第26行也没有你发布的内容列表。请在问题文本中指出您所指的代码