import zipfile
import os
zfile = zipfile.ZipFile('name.zip','r')
n_train = 0
for filename in zfile.namelist():
if filename.endswith('/'):
print(filename)
n_train += 1
os.makedirs(filename)
else:
data = zfile.read(filename)
file = open(filename, 'w+b')
file.write(data)
file.close()
print(n_train)