У меня есть archive.zip
с двумя файлами: hello.txt
и world.txt
Я хочу перезаписать файл hello.txt
новым с помощью этого кода:
import zipfile
z = zipfile.ZipFile('archive.zip','a')
z.write('hello.txt')
z.close()
но он не будет перезаписывать файл, так как он создает другой экземпляр hello.txt
- посмотрите на скриншот winzip:
Поскольку нет никакого smth, такого как zipfile.remove()
, что лучший способ справиться с этой проблемой?