Size of a remote URL

Diez B. Roggisch deetsNOSPAM at
Mon Aug 30 22:59:59 CEST 2004

First of all: post working code, not some snipplet that clearly isn't
capable of running due to syntactic and semantic errors.

This is what I made of your code:

from urllib2 import *
linklisttype = [""] *

file_sizes = []
for y in linklisttype:
    temp = urlopen(y)
    print temp
    temp2 =
    print temp2
    temp3 = temp2.getheader("Content-Length")
    print temp3

print file_sizes

This is the result:

<addinfourl at 1079834668 whose fp = <socket._fileobject object at
Date: Mon, 30 Aug 2004 20:57:49 GMT
Server: Apache/1.3.27 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b
DAV/1.0.3 PHP/4.3.2 mod_perl/1.26
Last-Modified: Sun, 20 Apr 2003 15:19:42 GMT
ETag: "f10f630-9a800-3ea2ba8e"
Accept-Ranges: bytes
Content-Length: 632832
Connection: close
Content-Type: application/msword



['632832', '632832', '632832', '632832']

Works perfect.


Diez B. Roggisch

More information about the Python-list mailing list