1
有人可以向我解釋爲什麼我的代碼沒有選擇PriorSettle td嗎?我得到了幾個月,但無論出於何種原因,PrioSettle列都沒有顯示出來。td數據的網頁報廢
lc_result={}
url = "http://www.cmegroup.com/trading/agricultural/livestock/live-cattle.html"
driver = webdriver.Chrome()
driver.set_window_size(2,2)
driver.get(url) #this will go the the actual url listed
print(' Live Cattle Futures'+localtime.center(50))
table = driver.find_element_by_id('quotesFuturesProductTable1')
for row in table.find_elements_by_tag_name('tr')[2:]:
month=row.find_elements_by_tag_name('td')[0].text
priorsettle=row.find_elements_by_tag_name('td')[4].text
print month, priorsettle
lc_result[month]=[priorsettle]
driver.close()
print(str(date.today()))
非常感謝alecxe。原代碼工作。 – Riggs 2014-10-21 00:13:38