Posts

Showing posts from October, 2017

Python data beautifulsoup

Beautifulsoup findAll(tag, attributes, recursive, text, limit, keywords) find(tag, attributes, recursive, text, keywords) .findAll({"h1","h2","h3","h4","h5","h6"}) .findAll("span", {"class":"green", "class":"red"}) .findAll(text="the prince") .findAll(id="text") Both are same bsObj.findAll(id="text") bsObj.findAll("", {"id":"text"}) Both are same bsObj.findAll(class_="green") bsObj.findAll("", {"class":"green"}) from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("http://www.pythonscraping.com/pages/page3.html") bsObj = BeautifulSoup(html) for child in bsObj.find("table",{"id":"giftList"}).children:     print(child) from urllib.request import urlopen from bs4 import BeautifulSoup html...