, ,print(adr)
, ,print('section '+str(count_s))
, ,print('text '+str(count_t))
, ,print('pic '+str(count_b))
, ,print('size file '+ str(os.path.getsize(adr)))
def parse_zip(adr):
, ,z = zipfile.ZipFile(adr, 'r')
, ,filelist = z.namelist()
, ,filelist.sort()
, ,for n in filelist:
, , , ,if n[-4:] == ".fb2":
, , , , , ,parse_fb2(z.open(n))
def parse_file(adr):
, ,if not os.path.isfile(adr):
, , , ,print('File not exists')
, , , ,return
, ,m = adr.split(".")
, ,if (m[-1] == "zip") and (m[-2] == "fb2"):
, , , , parse_zip(adr)
, ,elif (m[-1] == "fb2"):
, , , , parse_fb2(adr)
, ,
while True:
, ,qu = input('Введите ')
# , ,qu = '6.fb2.zip'
, ,a = os.path.join(path, qu)
, ,parse_file(a)