On May 27, 3:37 pm, Scott David Daniels <scott.dani...@acm.org> wrote:
> powah wrote:
> > ...
> > I fixed one error, now if the filename is misspelled, how to ignore
> > the error and continue?
>
> You really should go through the tutorial.  It will explain this and
> other important things well.  But, since I'm feeling generous:
>
> Replace this:>     u=urllib2.urlopen(link)
> >     p=u.read()
> >     open(filename,"w").write(p)
>
> with this:
>        try:
>            u = urllib2.urlopen(link)
>            p = u.read()
>        except urllib2.HTTPError:
>            pass
>        else:
>            dest = open(filename, "w")
>            dest.write(p)
>            dest.close()
>
> --Scott David Daniels
> scott.dani...@acm.org

Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to