Not getting the output,getting the warning instead

0 Ambuj Gupta · October 21, 2015
C:\Python34\lib\site-packages\bs4\__init__.py:166: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

To get rid of this warning, change this:

 BeautifulSoup([your markup])

to this:

 BeautifulSoup([your markup], "html.parser")

  markup_type=markup_type))


Please help in this
I am not getting the output

Post a Reply

Replies

Oldest  Newest  Rating
+1 sfolje 0 · October 22, 2015
ok, so if you look in 'error' warning, it actualy tells you what to do.
it tells us to change
BeautifulSoup([your markup])
to this:
BeautifulSoup([your markup], "html.parser")
Lets see a example:
code:
BeautifulSoup([your markup])

is a general form of code, so example of this code would be
BeautifulSoup(<a class="index_singleListingTitles" href="/posts.php?user=2&post=56877">)

or another example:
BeautifulSoup(plain_text )

,where plain_text is some variable, i made before.
So in my second example:
([your markup]) 

stands for
(plain_text )

So, changing it to
BeautifulSoup([your markup], "html.parser") 

would look like:
BeautifulSoup(plain_text ,"html.parser")

If i sum up, in my personal program code, I would change line:
soup = BeautifulSoup(plain_text )

into line:
soup = BeautifulSoup(plain_text , "html.parser")

Now it works fine for me.
  • 1

Python

107,204 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator