kj7ny wrote: > compare a file on a hard drive to a file in a python created zip file > to tell if the file has changed?
>>> fileondisk = r'C:\Documents and Settings\power\Desktop\ES3dc+Template.3f' >>> zipondisk = r'C:\Documents and Settings\power\Desktop\temps.zip' >>> import zipfile >>> z = zipfile.ZipFile(zipondisk) >>> z.namelist() ['ES1+Template.3f', 'ES3sc+Template.3f', 'ES3dc+Template.3f'] >>> info = z.getinfo('ES3dc+Template.3f') >>> info.CRC 1620938006 >>> import binascii >>> checksum = 0 >>> fp = open(fileondisk, 'rb') >>> while 1: ... data = fp.read(32*1024) ... if not data: break ... checksum = binascii.crc32(data, checksum) ... >>> checksum 1620938006 >>> -- http://mail.python.org/mailman/listinfo/python-list