Ahoj, mám problém, potřebuju v Pythonu rozbalit zip soubor pomocí zipfile. Ovšem soubory v tom zipu můžou být s diakritikou. Je nejaka moznost jak to zkopirovat do filesystemu bez diakritiky? Zkousel jsem decode a unicode .. moc mi to neslo..tady je samplecode s tim unicode() - nejde:
def unzip(path,path_to):
archive = ZipFile(path, "r", ZIP_DEFLATED)
if not archive.testzip():
names = archive.namelist()
for name in names:
unicode(name,'cp852')
if name.endswith('/'):
if not os.path.exists(os.path.dirname(path_to + unicode(name,'utf-8'))):
# Create that directory
os.mkdir(os.path.dirname(path_to + unicode(name,'utf-8')))
# Write files to disk
else:
temp = open(path_to + unicode(name,'utf-8'), "wb") # create the file
data = archive.read(name) #read the binary data
temp.write(data)
temp.close()
archive.close()
return "\""+path+"\" was unzipped successfully."
else:
return 'Rozbaleno'
Díky za rady...