`document.lastModified` in Python
Question: In python, by using an HTML parser, is it possible to get the
`document.lastModified` property of a web page. I'm trying to retrieve the
date at which the webpage/document was last modified by the owner.


Answer: A somewhat related question "[I am downloading a file using Python urllib2.
How do I check how large the file size
is?](http://stackoverflow.com/questions/1636637/i-am-downloading-a-file-using-
python-urllib2-how-do-i-check-how-large-the-file)", suggests that the
following (untested) code should work:

    
    
    import urllib2          
    req = urllib2.urlopen("http://example.com/file.zip")
    total_size = int(req.info().getheader('last-modified'))
    

You might want to add a default value as the second parameter to
`getheader()`, in case it isn't set.

