python – ImportError: No module named BeautifulSoup

python – ImportError: No module named BeautifulSoup

Try this from bs4 import BeautifulSoup

This might be a problem with Beautiful Soup, version 4, and the beta days. I just read this from the homepage.

On Ubuntu 14.04 I installed it from apt-get and it worked fine:

sudo apt-get install python-beautifulsoup

Then just do:

from BeautifulSoup import BeautifulSoup

python – ImportError: No module named BeautifulSoup

Try This, Mine worked this way. To get any data of tag just replace the a with the tag you want.

from bs4 import BeautifulSoup as bs
import urllib

url=http://currentaffairs.gktoday.in/month/current-affairs-january-2015

soup = bs(urllib.urlopen(url))
for link in soup.findAll(a):
        print link.string

Leave a Reply

Your email address will not be published.