[python]替换压缩包指定路径下的文件?
写了个程序,想做成自动更新的,用py2exe打的包,压在了shared.zip中,其中自己写的库文件在shared.zip中的lib目录下
zipfile试了半天不行
又找了 chilkat.CkZip,用它的chilkat.CkByteData 的appendFile()可以替换文件,但是压进去的文件程序不能用
用下面的函数却不能压进 lib 子目录
def replaceFileInZip(zipfilename,src,dest):
zip = chilkat.CkZip()
if not zip.UnlockComponent('test'):return False
if not zip.OpenZip(zipfilename):return False
entry = zip.FirstMatchingEntry(src)
if entry == None:return False
zip.DeleteEntry(entry)
if not zip.AppendOneFileOrDir(dest,False):return False
return zip.WriteZipAndClose()
请问各位童鞋有没有好的思路或者库
我已经google一晚上了,特来求助,分不够可以加