“逃跑”;[“在css选择器beatifulsoup python中”

“逃跑”;[“在css选择器beatifulsoup python中”,python,css,beautifulsoup,escaping,selector,Python,Css,Beautifulsoup,Escaping,Selector,这是我的意见: 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) Val

这是我的意见:

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


转义有什么问题?

在element.py的606行中:

r'=?"?(?P<value>[^\]"]*)"?\]$'

不熟悉BeautifulSoup,但您可以尝试使用有问题字符的十六进制代码进行转义。
'input[name=user\5Bname\5D]
'input[name*=\\"user\[name]'