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


Groups > comp.lang.python > #74908

Html Parsing stuff

Newsgroups comp.lang.python
Date 2014-07-21 00:20 -0700
Message-ID <b0caa90b-bf6b-4d3c-b6ff-43246e006b70@googlegroups.com> (permalink)
Subject Html Parsing stuff
From Nicholas Cannon <nicholascannon1@gmail.com>

Show all headers | View raw


Ok i get the basics of this and i have been doing some successful parsings and using regular expressions to find html tags. I have tried to find an img tag and write that image to a file. I have had no success. It says it has successfully wrote the image to the file with a try... except statement but when i try to open this it says that the image has like no been saved correctly or is damaged. This was just reading the src attribute of the tag and trying to save that link to a .jpg(the extension of the image). Ok so i looked deeper and added a forward slash to the url and then added the image src attribute to it. I then opened that link with the urllib.urlopen() and then read the contents and saved it to the file again. I still got the same result as before. Is there a function in beautiful soup or the urllib module that i can use to save and image. This is just a problem i am sorting out not a whole application so the code is small. Thanks

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


Thread

Html Parsing stuff Nicholas Cannon <nicholascannon1@gmail.com> - 2014-07-21 00:20 -0700
  Re: Html Parsing stuff Nicholas Cannon <nicholascannon1@gmail.com> - 2014-07-21 02:13 -0700

csiph-web