我的代码是基于浏览器自动化的selenium,web抓取。在这个概念中,我们需要给铬驱动程序路径。在windows中,路径使用反斜杠"\“。但是python不接受反斜杠。还有其他的可能吗?供您参考,我将我的代码和错误粘贴在下面。
from selenium import webdriver
from quotes_page.overall_selenium import Alltags
chrome=webdriver.Chrome(executable_path="C:\Users\ShanuMadhu\Desktop\python\chromedriver.exe")
chrome.get('http://quotes.toscrape.com')
page=Alltags(chrome)
for pages in page.Paasing_allTag:
print(pages)Error SyntaxError:(unicode错误)‘独角形转义’编解码器无法解码位置2-3的字节:截断\UXXXXXXXX转义
发布于 2019-11-10 11:43:52
在反斜杠上加倍
I.e
chrome=webdriver.Chrome(executable_path="C:\\Users\\ShanuMadhu\\Desktop\\python\\chromedriver.exe")https://stackoverflow.com/questions/58788271
复制相似问题