python: Open file from zip without temporary extracting it
Question: How can I open files from a zip archive without extracting them first?

I'm using pygame. To save disk space, I have all the images zipped up. Is it
possible to load a given image directly from the zip file? For example:
`pygame.image.load('zipFile/img_01')`


Answer: Vincent Povirk's answer won't work completely;

    
    
    import zipfile
    archive = zipfile.ZipFile('images.zip', 'r')
    imgfile = archive.open('img_01.png')
    ...
    

You have to change it in:

    
    
    import zipfile
    archive = zipfile.ZipFile('images.zip', 'r')
    imgdata = archive.read('img_01.png')
    ...
    

For details read the notes under 'ZipFile.open(name[, mode[, pwd]])' in the
documentation on: <http://docs.python.org/2/library/zipfile>

