2
这是我输入:转义 “[” 在CSS选择beatifulsoup蟒蛇
input autocomplete="off" id="one-step-full-name" name="user[name]"
当我尝试:
BeautifulSoup.select('input[name=user\[name\]]')
我得到:
lib\site-packages\bs4\element.py", line 1477, in select 'Unsupported or invalid CSS selector: "%s"' % token) ValueError: Unsupported or invalid CSS selector: "input[name=user[name]]"
BeatifulSoup版本4.6.0
逃跑有什么问题?
不熟悉BeautifulSoup,但你可以尝试与违规字符的十六进制代码逃逸。 ' '输入[名称=用户\ 5Bname \ 5D]'' –