app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import os path = "files" fun = lambda x : os.path.isfile(os.path.join(path,x)) files_list = filter(fun, os.listdir(path)) size_of_file = [ (f,os.stat(os.path.join(path, f)).st_size) for f in files_list ] for f,s in size_of_file: print("{} : {}MB".format(f, round(s/(1024*1024),3))) |