my code can work, like below:

import os
import zipfile
z =
zipfile.ZipFile(r"c:\text.zip",mode="w",compression=zipfile.ZIP_DEFLATED)
cwd = os.getcwd()
try:
    for dirpath,dirs,files in os.walk(cwd):
        for file in files:
            z_path = os.path.join(dirpath,file)
            z.write(z_path)
    z.close()
finally:
    if z:
        z.close()

that is true
but the archive  include the absolute path .
can you give me a way to build it with relative path.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to