Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.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.030 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'killer': 0.07; 'lawrence': 0.09; 'occurrences': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'language.': 0.14; 'posted': 0.15; '2.7.2': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'spacing': 0.16; 'subject:class': 0.16; 'prevent': 0.16; 'thursday,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'working.': 0.19; 'solution.': 0.20; 'thanks.': 0.20; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'url:moin': 0.24; '---': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; "i'm": 0.30; 'code': 0.31; 'that.': 0.31; 'url:wiki': 0.31; '>>>>': 0.31; 'correctly.': 0.31; 'workaround': 0.31; 'writes:': 0.31; 'class': 0.32; 'url:python': 0.33; 'actual': 0.34; 'there': 0.35; 'doing': 0.36; 'next': 0.36; 'url:org': 0.36; 'should': 0.36; 'so,': 0.37; 'two': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'above,': 0.60; 'free': 0.61; 'reserved': 0.61; 'march': 0.61; 'medical': 0.61; 'viruses': 0.61; 'john': 0.61; "you're": 0.61; 'further': 0.61; 'first': 0.61; 'email addr:gmail.com': 0.63; 'protection': 0.63; 'real': 0.63; 'our': 0.64; 'sample': 0.67; 'antivirus': 0.68; "today's": 0.70; 'wish': 0.70; 'serial': 0.72; 'subject:get': 0.81; "'class'": 0.84; '2014,': 0.84; 'doctor': 0.91; 'imagine': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: beautiful soup get class info Date: Fri, 07 Mar 2014 01:48:59 +0000 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-147-190-58.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: X-Antivirus: avast! (VPS 140306-1, 06/03/2014), Outbound message X-Antivirus-Status: Clean 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: 71 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394156960 news.xs4all.nl 2915 [2001:888:2000:d::a6]:33394 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67974 On 07/03/2014 01:37, teddybubu@gmail.com wrote: > On Thursday, March 6, 2014 4:28:06 PM UTC-6, John Gordon wrote: >> In 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 >> >> watch 'House', or a real serial killer to watch 'Dexter'. > > ok I got this working. now to the next problem.... thanks. > I'm pleased to see that you have a solution. Now, should you wish to ask further questions, would you please read and action this first https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the double line spacing above, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com