I'm using the ZipFile package to zip file in Python. Here's my code:

archive = zipfile.ZipFile(join(settings.ARCHIVES_DIR, 'test.zip'), "a")

for pdffile in glob.glob(join(settings.IBILLING_DIR, '*.pdf')):
    archive.write(pdffile)

archive.close()

The issue I'm facing is that the ZIP file that is created, contains a directory structure. The files that are added are added with the full the path which means that the user that extracts the archive, will also end up getting a directory structure. I'd like to the add files to the ZIP but without any directory structure.

How can I do this? I didn't find this information in the docs.

Thanks

Edit
Report