Unfortunately there isn't necessarily an *easy* way to do this, but you definitely can do it.
You'll need to unzip the file, and then edit the contents in a new directory, zip it back up, and delete the temporary folder. You'll need the zipfile package for unzipping and the shutil package for packaging it back up.
from zipfile import ZipFile
foldername = basefilename(minus extensions)
with ZipFile(foldername + '.' + 'zip', 'r') as zipObj:
os.remove(foldername + '.zip')
#do whatever you want to do inside of the foldername directory here.
shutil.make_archive(foldername, 'zip', foldername)
#the temporary directory will still be around, so you'll need to delete all of the contents
#and then delete the actual folder.
for filename in os.listdir(filenamebase):
file_path = os.path.join(filenamebase, filename)
if os.path.isfile(file_path) or os.path.islink(file_path):
except Exception as e:
print('Failed to delete %s. Reason: %s' % (file_path, e))