Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: beautiful soup get class info Date: Thu, 6 Mar 2014 22:28:06 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 26 Message-ID: References: NNTP-Posting-Host: panix1.panix.com X-Trace: reader1.panix.com 1394144886 9512 166.84.1.1 (6 Mar 2014 22:28:06 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Thu, 6 Mar 2014 22:28:06 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:67958 In teddybubu@gmail.com writes: > > soup.find_all(name="span", class="date") > I have python 2.7.2 and it does not like class in the code you provided. Oh right, 'class' is a reserved word. I imagine beautifulsoup has a workaround for that. > Now when I take out [ class="date"], this is returned: > [March 5, 2014, March 5, 2014] > > This is the code I am using: "data = soup.find_all(name="span") > print (data)" > 1. it returns today's date instead of the actual date > 2. returns it twice Are there two occurrences of 'March 5, 2014' in the HTML? If so, then beautifulsoup is doing its job correctly. It might help if you posted the sample HTML data you're working with. -- John Gordon Imagine what it must be like for a real medical doctor to gordon@panix.com watch 'House', or a real serial killer to watch 'Dexter'.