[Tutor] Downloading from http

Kent Johnson kent37 at tds.net
Sun Feb 13 01:02:58 CET 2005


Mark Kels wrote:
> On Sat, 12 Feb 2005 09:25:10 -0500, Jacob S. <keridee at jayco.net> wrote:
> 
>>urllib or urllib2 or maybe httplib maybe?
>>
>>        urlopen( url[, data])
> I'm sorry, but I didn't understood a thing (maybe its because of my
> bad english, and mybe its because I'm just dumb :). Anyway, can you
> give me a code example or a link to a tutorial that talks about this ?

  >>> from urllib import urlopen
  >>> u=urlopen('http://www.google.com')
  >>> d=u.read()
  >>> print d[:200]
<html><head><meta http-equiv="content-type" content="text/html; 
charset=ISO-8859-1"><title>Google</title><style><!--
body,td,a,p,.h{font-family:arial,sans-serif;}
.h{font-size: 20px;}
.q{color:#0000cc



More information about the Tutor mailing list