【发布时间】:2020-03-24 08:02:14
【问题描述】:
我试图从网络中提取数据。很少有拉丁字母采用纯十六进制格式。
例如:
https://www.zomato.com/ncr/café-mrp-connaught-place-new-delhi
这个链接会变成
https://www.zomato.com/ncr/caf%C3%A9-mrp-connaught-place-new-delhi
我如何从这里取回拉丁字母。我想概括这一点,并对我的数据框中发生变化的所有拉丁字母进行此操作。
i=1
main_page_url = r"https://www.zomato.com/ncr/connaught-place-delhi-restaurants"
chrome_path = r"C:\Users\HPO2KOR\Desktop\chromedriver.exe"
wd = webdriver.Chrome(chrome_path)
wd.get(main_page_url)
while(i<=2):
rests = wd.find_elements_by_xpath('//a[@class="result-title hover_feedback zred bold ln24 fontsize0 "]')
for rest in rests:
df = df.append({'Rest Name' : rest.text,
'URL' : rest.get_attribute("href")}, ignore_index=True)
nxt_pg = wd.find_element_by_xpath('//a[@class="paginator_item next item"]')
nxt_pg.click()
wd.switch_to_window(wd.window_handles[0])
i+=1
wd.close()
【问题讨论】:
-
这能回答你的问题吗? Url decode UTF-8 in Python
标签: python web-scraping latin