Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5543

Re: Trying to understand html.parser.HTMLParser

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bahamutzero8825@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.134
X-Spam-Level *
X-Spam-Evidence '*H*': 0.73; '*S*': 0.00; 'python.': 0.05; 'python': 0.07; 'am,': 0.14; 'broken': 0.14; 'wrote:': 0.14; 'exemple': 0.16; 'subject:Trying': 0.16; 'header:In-Reply-To:1': 0.22; 'wrote': 0.25; 'extract': 0.25; 'assume': 0.25; "i'm": 0.26; "i'll": 0.26; "doesn't": 0.28; 'looks': 0.28; 'thanks': 0.29; 'message-id:@gmail.com': 0.30; 'all.': 0.30; 'implement': 0.30; 'seem': 0.30; "won't": 0.30; 'to:addr:python-list': 0.32; 'expression': 0.33; 'implemented': 0.33; 'updated': 0.33; 'received:192.168.1': 0.34; 'received:192': 0.34; 'regular': 0.34; 'couple': 0.35; 'print': 0.35; 'url:en': 0.35; 'header:User- Agent:1': 0.35; 'received:192.168': 0.37; 'received:209.85': 0.37; 'received:google.com': 0.38; 'but': 0.38; 'url:org': 0.38; 'not,': 0.39; 'docs': 0.39; 'to:addr:python.org': 0.39; 'could': 0.39; 'received:209': 0.39; "it's": 0.40; 'header:Received:5': 0.40; 'might': 0.40; 'url:net': 0.62; 'link': 0.62; 'below': 0.63; 'website': 0.66; 'links:': 0.68; 'afraid': 0.69; 'url:en-us': 0.69; 'received:209.85.210.174': 0.84; 'received:mail- iy0-f174.google.com': 0.84; 'url:addons': 0.84; 'url:mozilla': 0.84; 'url:pl': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=NNiS13LakdYGGdPOYsx+13HLhePIKdpIjyr8u7DzIvo=; b=eWk/wmMDcJ0JOF9HG09dF/D159r3yegS4gAkDq7kZU9OuZ6zooydlC5ZaMNSYiaxjO wnDvl7qRpQPmBVVUu1OmjkrN2JmdOt/AWbRSo9oS78tRIpjFSBzjPRQMc0XX8K6pnDGL 17Mw5a59/wREutVy787QkbXVyoLrnYiz6za/Q=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=LwmrEPzf3EbxDUJwL31faPb0KKoMH9G/+K3lMB4e7ccPFgdiOZuPJfT73EBTiTodFK vld7hYPx/UNYGRW+4fLf0inRruTsHQ3vsnrHADIU0LUWD08o91/LqxMIwgvFJaftPRnR 0WoKxgzfe8r7QEsRrxJoWNVy6xHZOgY/U+8hc=
Date Mon, 16 May 2011 20:05:25 -0500
From Andrew Berg <bahamutzero8825@gmail.com>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5
MIME-Version 1.0
To python-list@python.org
Subject Re: Trying to understand html.parser.HTMLParser
References <4DD03B69.6050301@gmail.com> <BANLkTikcc6wVX+aO7KATa8AK1BJJKN5kMw@mail.gmail.com> <4DD0D1A2.6060109@free.fr>
In-Reply-To <4DD0D1A2.6060109@free.fr>
X-Enigmail-Version 1.1.1
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1653.1305594331.9059.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 82.94.164.166
X-Trace 1305594332 news.xs4all.nl 49177 [::ffff:82.94.164.166]:41142
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5543

Show key headers only | View raw


On 2011.05.16 02:26 AM, Karim wrote:
> Use regular expression for bad HTLM or beautifulSoup (google it), below 
> a exemple to extract all html links:
>
> linksList = re.findall('<a href=(.*?)>.*?</a>',htmlSource)
> for link in linksList:
>      print link
I was afraid I might have to use regexes (mostly because I could never
understand them).
Even the BeautifulSoup website itself admits it's awful with Python 3 -
only the admittedly broken 3.1.0 will work with Python 3 at all.
ElementTree doesn't seem to have been updated in a long time, so I'll
assume it won't work with Python 3.
lxml looks promising, but it doesn't say anywhere whether it'll work on
Python 3 or not, which is puzzling since the latest release was only a
couple months ago.

Actually, if I'm going to use regex, I might as well try to implement
Versions* in Python.

Thanks for the answers!

*http://en.totalcmd.pl/download/wfx/net/Versions (original, made for
Total Commander) and
https://addons.mozilla.org/en-US/firefox/addon/versions-wfx_versions/
(clone implemented as a Firefox add-on; it's so wonderful, I even wrote
the docs for it!)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Trying to understand html.parser.HTMLParser Andrew Berg <bahamutzero8825@gmail.com> - 2011-05-16 20:05 -0500

csiph-web