Demo entry 6065215

fuckoff

   

Submitted by anonymous on Sep 23, 2016 at 19:43
Language: Python. Code size: 1.1 kB.

import os

def hitung_buku(*folders):
    file_list = []
    file_dict = {}
    i = 0
    folder_len = len(folders)
    while i < folder_len:
        for foldername, subfolders, filenames in os.walk(folders[i]):
            for filename in filenames:
                if filename.endswith(".pdf") or filename.endswith('.djvu') or \
                filename.endswith(".mobi") or filename.endswith(".epub"):
                    nama_file = filename
                    file_list.append(nama_file)
                    nama_folder = ''
                    if nama_folder != foldername:
                        nama_folder = foldername
                        print()
                        print(nama_folder)
                        print()
                        
                    if nama_folder == foldername:
                        for i in range(len(file_list)):
                            print(i + 1, file_list[i])
                        continue

        i += 1

folders = ()
total = hitung_buku("C:\\Users\\marsya\\Downloads", "D:\\", "H:\\")
print("\n\nTotal buku di dalam hardisk anda adalah: ", total)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).