Solve task

This commit is contained in:
2021-10-13 22:03:12 +03:00
parent ed1eed7d0a
commit 79afe02da4
5 changed files with 165 additions and 12 deletions
+4 -4
View File
@@ -3,13 +3,13 @@ import zipfile
import csv
res = []
zips = os.listdir('Nintendo DS')
zips = os.listdir("Nintendo DS")
for z in zips:
with zipfile.ZipFile('Nintendo DS/'+z) as myzip:
with zipfile.ZipFile("Nintendo DS/" + z) as myzip:
info = myzip.infolist()
for i in info:
res.append([z, i.filename, int(i.file_size/(1024**2))])
res.append([z, i.filename, int(i.file_size / (1024 ** 2))])
with open('archive.csv', 'w', newline='') as f:
with open("archive.csv", "w", newline="") as f:
writer = csv.writer(f)
writer.writerows(res)