这是我的输入:
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>[^\]"]*)"?\]$'
右括号符号(])不能存在于双引号("")中。
你可以试试:
'input[name*=\\"user\[name]'
