Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 没有明确指定解析程序的原因。代码中需要做哪些更改? 从bs4导入美化组 soup=BeautifulSoup(打开(“index.html”)) soup=BeautifulSoup(“数据”)_Python 2.7_Beautifulsoup - Fatal编程技术网

Python 2.7 没有明确指定解析程序的原因。代码中需要做哪些更改? 从bs4导入美化组 soup=BeautifulSoup(打开(“index.html”)) soup=BeautifulSoup(“数据”)

Python 2.7 没有明确指定解析程序的原因。代码中需要做哪些更改? 从bs4导入美化组 soup=BeautifulSoup(打开(“index.html”)) soup=BeautifulSoup(“数据”),python-2.7,beautifulsoup,Python 2.7,Beautifulsoup,收到此警告: 美化组([您的标记]) 为此: BeautifulSoup([您的标记],“lxml”) markup\u type=markup\u type))beautifulsou需要知道解析什么 您提供的东西可能是html,可能是xml, 两者的结构有所不同 因此,在函数的第二个参数中,您需要指定给定文档是html/xml还是其他形式 from bs4 import BeautifulSoup soup = BeautifulSoup(open("index.html")) soup =

收到此警告: 美化组([您的标记]) 为此: BeautifulSoup([您的标记],“lxml”)
markup\u type=markup\u type))

beautifulsou需要知道解析什么 您提供的东西可能是html,可能是xml, 两者的结构有所不同 因此,在函数的第二个参数中,您需要指定给定文档是html/xml还是其他形式

from bs4 import BeautifulSoup
soup = BeautifulSoup(open("index.html"))
soup = BeautifulSoup(""<html>data</html>"")
从bs4导入美化组
src='数据''
soup=BeautifulSoup(src,“html.parser”)

虽然此代码片段很受欢迎,可能会提供一些帮助,但它将讨论如何解决问题。如果没有这些,你的答案就没有什么教育价值——记住,你是在将来为读者回答这个问题,而不仅仅是现在提问的人!请在回答中添加解释,并说明适用的限制和假设。先生仍然存在该错误。您可以解释您的错误吗?通过添加我要解析的文档类型作为BeautifulSoup()函数的第二个参数来解决。谢谢大家的帮助。
from bs4 import BeautifulSoup
src='"<html>data<//html>"'
soup=BeautifulSoup(src,"html.parser")