Unzipping a Zip File in Django

django, python

Solution

https://superuser.com/questions/104500/what-is-macosx-folder

if libitem.startswith('__MACOSX/'):
  continue

Problem

I'm trying to unzip a zip file in Django using the `zipfile` library. This is my code: ``` if formtoaddmodel.is_valid(): content = request.FILES['content'] unzipped = zipfile.ZipFile(content) print unzipped.namelist() for libitem in unzipped.namelist(): filecontent = file(libitem,'wb').write(unzipped.read(libitem)) ``` This is the output of `print unzipped.namelist()` ``` ['FileName1.jpg', 'FileName2.png', '__MACOSX/', '__MACOSX/._FileName2.png'] ``` Im wondering what the last two items are -- it looks like the path. I don't care about there -- so how is there a way to filter them out?

Original source