How to dispaly data from html tags using python Beautiful Soup

import requests
from bs4 import BeautifulSoup

link = "http://www.flipkart.com/mobiles?otracker=hp_header_nmenu_sub_Electronics_0_Mobiles"
doc = requests.get(link)
soup = BeautifulSoup(doc.text, 'html.parser')
main_div = soup.find(id="list-tagcloud")
div2=main_div.find_all('div')[1]
for x in div2.strings:
    print x

OUTPUT
======

Motorola

Lenovo

Samsung

LeEco

Yunicorn

Honor

Mi

Asus

Apple

Intex

Sony

Alcatel

Lava

Gionee

All



Comments

Popular posts from this blog

AttributeError: Got AttributeError when attempting to get a value for field `abc` on serializer `PfleSerializer`. The serializer field might be named incorrectly and not match any attribute or key on the `QuerySet` instance. Original exception text was: 'QuerySet' object has no attribute 'abc'.

ImportError: No module named regex