Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81136
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Denis McMahon <denismfmcmahon@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Tag objects in Beautiful Soup |
| Date | Thu, 20 Nov 2014 22:49:42 +0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 44 |
| Message-ID | <m4lr65$vvt$3@dont-email.me> (permalink) |
| References | <a7667688-96e9-4ba6-a343-42a757d784be@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Thu, 20 Nov 2014 22:49:42 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="66ffcfa4470a58bcddbdcd1913f98ab4"; logging-data="32765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19b25kN8BbOH+NrDjpIr0w+qV0iUd6B/vw=" |
| User-Agent | Pan/0.136 (I'm far too busy being delicious; GIT 926a150 git://git.gnome.org/pan2) |
| Cancel-Lock | sha1:M/tSKhOiG6yRTVBlin7EnDqq66k= |
| Xref | csiph.com comp.lang.python:81136 |
Show key headers only | View raw
On Thu, 20 Nov 2014 06:31:08 -0800, Simon Evans wrote: > Can anyone tell me where I am going wrong or where the text is wrong ? > So far the given code has run okay, I have put to the console everything > the text tells you to. Thank you for reading. > Simon Evans Having looked at the ebook, there seems to be an error in the book. Unfortunately I'm not 100% sure what the error is. However, it may be that: atag = soup_atag.a is meant to be: atag = soup.a There are also errors in the html itself in the ebook, the href of each of the urls is quoted as href="....' (mixing single and double quotes) and one of the urls has a semi-colon where a colon is expected, these seem to throw the parser. These errors also appear in your html snippet: html_atag = """<html><body><p>Test html a tag example</p> <a href="http://www.packtpub.com'>Home</a> ........^.......................^ <a href="http;//www.packtpub.com/books'.Books</a> ........^....^........................^ </body> </html>""" In addition to these errors in the source html, you seem to have replaced a '>' with a '.' on the second anchor tag in the html. <a href="http;//www.packtpub.com/books'.Books</a> .......................................^ -- Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Tag objects in Beautiful Soup Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-11-20 06:31 -0800 Re: Tag objects in Beautiful Soup Peter Otten <__peter__@web.de> - 2014-11-20 16:02 +0100 Re: Tag objects in Beautiful Soup Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-20 22:49 +0000
csiph-web