Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'problem:': 0.07; '22,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:software': 0.09; 'argument.': 0.16; 'received:80.91.229.3': 0.16; 'received:97': 0.16; 'received:plane.gmane.org': 0.16; 'subject:class': 0.16; 'wrote:': 0.18; 'thanks.': 0.20; 'header:User-Agent:1': 0.23; 'fine': 0.24; "haven't": 0.24; 'code:': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'code': 0.31; 'workaround': 0.31; 'but': 0.35; 'christopher': 0.36; 'date.': 0.36; 'from:addr:live.com': 0.36; 'in:': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'march': 0.61; 'email addr:gmail.com': 0.63; 'worth': 0.66; 'here': 0.66; 'believe': 0.68; 'results': 0.69; 'subject:get': 0.81; "'class'": 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Christopher Welborn Subject: Re: beautiful soup get class info Date: Tue, 11 Mar 2014 21:04:13 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 97-82-32-107.dhcp.mtgm.al.charter.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394589869 news.xs4all.nl 2830 [2001:888:2000:d::a6]:51960 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68257 On 03/06/2014 02:22 PM, teddybubu@gmail.com wrote: > I am using beautifulsoup to get the title and date of the website. > title is working fine but I am not able to pull the date. Here is the code in the url: > > October 22, 2011 > > In Python, I am using the following code: > date1 = soup.span.text > data=soup.find_all(date="value") > > Results in: > > [] > March 5, 2014 > > What is the proper way to get this info? > Thanks. > I believe it's the 'attrs' argument. http://www.crummy.com/software/BeautifulSoup/bs4/doc/ # Workaround the 'class' problem: data = soup.find_all(attrs={'class': 'date'}) I haven't tested it, but it's worth looking into. -- \¯\ /¯/\ \ \/¯¯\/ / / Christopher Welborn (cj) \__/\__/ / cjwelborn at live·com \__/\__/ http://welbornprod.com