Posted on 2006-11-03
Sorry if this is a stupid question, but I am a bit stuck. I am using info() from urllib2. It returns the metadata of the url. I would like to print 'some' of this info to the screen, but I can't seem to get just what I want. I would like to avoid re, but am prepared to use it if needed.
For example. Calling info() on cnn.com produces this output:
ate: Sat, 04 Nov 2006 00:01:09 GMT
Cache-Control: max-age=60, private
Expires: Sat, 04 Nov 2006 00:02:01 GMT
How would I just get parts of it? For example, just the Server and content-type. Or the content length, expiration and ate? I believe that info() returns a dict, but I am not sure.