成功解决 bs4\__init__.py:219: UserWarning: "b'.'" looks like a filename, not markup. You should probably

成功解决 bs4\__init__.py:219: UserWarning: "b'.'" looks like a filename, not markup. You should probably


解决问题

F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:219: UserWarning: "b'.'" looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.
  ' Beautiful Soup.' % markup)
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:282: UserWarning: "http://www./details/LovefromaStranger"" looks like a URL. Beautiful Soup is not an HTTP client. You should probably use an HTTP client like requests to get the document behind the URL, and feed that document to Beautiful Soup.
  ' that document to Beautiful Soup.' % decoded_markup
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:282: UserWarning: "http://www.loosechangeguide.com/LooseChangeGuide.html"" looks like a URL. Beautiful Soup is not an HTTP client. You should probably use an HTTP client like requests to get the document behind the URL, and feed that document to Beautiful Soup.
  ' that document to Beautiful Soup.' % decoded_markup
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:219: UserWarning: "b'... ...'" looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.
  ' Beautiful Soup.' % markup)
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:219: UserWarning: "b'...'" looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.
  ' Beautiful Soup.' % markup)
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:219: UserWarning: "b'....'" looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.
  ' Beautiful Soup.' % markup)
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:282: UserWarning: "http://www.msnbc.msn.com/id/4972055/site/newsweek/"" looks like a URL. Beautiful Soup is not an HTTP client. You should probably use an HTTP client like requests to get the document behind the URL, and feed that document to Beautiful Soup.
  ' that document to Beautiful Soup.' % decoded_markup
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:219: UserWarning: "b'..'" looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.
  ' Beautiful Soup.' % markup)
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:282: UserWarning: "http://www.youtube.com/watch?v=a0KSqelmgN8"" looks like a URL. Beautiful Soup is not an HTTP client. You should probably use an HTTP client like requests to get the document behind the URL, and feed that document to Beautiful Soup.
  ' that document to Beautiful Soup.' % decoded_markup
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:219: UserWarning: "b'.. .'" looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.
  ' Beautiful Soup.' % markup)
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:282: UserWarning: "http://jake-weird.blogspot.com/2007/08/beneath.html"" looks like a URL. Beautiful Soup is not an HTTP client. You should probably use an HTTP client like requests to get the document behind the URL, and feed that document to Beautiful Soup.
  ' that document to Beautiful Soup.' % decoded_markup

解决思路

发生地址:bs4\__init__.py:219:
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:219:
用户警告:“b”。看起来像文件名,而不是标记。您可能应该打开这个文件并将文件句柄传递到Beautiful Soup中。
F:\Program Files\Python\Python36\lib\site-packages\bs4\__init__.py:282:
用户警告:“http://www./details/LovefromaStranger”“看起来像一个URL”。Beautiful Soup不是HTTP客户机。您可能应该使用HTTP客户机之类的请求来获取URL后面的文档,并将该文档提供给Beautiful Soup。
  ' that document to Beautiful Soup.' % decoded_markup
F: \ Python程序文件\ \ Python36 \ lib \网站\ bs4 \ __init__。用户警告:“http://www.loosechangeguide.com/LooseChangeGuide.html”“看起来像一个URL”。Beautiful Soup不是HTTP客户机。您可能应该使用HTTP客户机之类的请求来获取URL后面的文档,并将该文档提供给Beautiful Soup。
  ' that document to Beautiful Soup.' % decoded_markup

解决方法

此信息提示为警告,而不是error,即使不处理也不会影响代码编程的运行。如果想要去掉,可以更新库至最新版本!
然后根据要求提示修改使用方法!

(0)

相关推荐