On Fri, Nov 20, 2009 at 1:54 AM, MARCUS NG <marker...@gmail.com> wrote: > Hey all, > I have been searching online for ways to copy a zip file to a destination > and extract the zip file with python. > Currently nothing works due to my limited understanding. > I am wondering if my syntax is wrong or am I missing anything?
You don't say how it fails but you should at least escape the \ in the paths as \\ or use raw strings (r'C:\Users...') The \char codes are escape codes so your paths are not correct. Kent > the code is as such. also if there is a better code, I am definitely open to > it. If it is good, can you also explain steps? > ########### > > import shutil, zipfile > shutil.copyfile('C:\Users\blueman\Desktop\myTest1.0.zip', > 'C:\Users\blueman\Desktop\allFiles') > > zipfilepath='C:\Users\blueman\Desktop\allFiles\myTest1.0.zip' > extractiondir='C:\Users\blueman\Desktop\allFiles\test' > > def extract(zipfilepath, extractiondir): > zip = zipfile(zipfilepath) > zip.extractall(path=extractiondir) > print 'it works' > > extract() > > ########### > thank you so much for your time and help in advance!!! > > > , > Marcus > > _______________________________________________ > Tutor maillist - tu...@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor