1. 程式人生 > >計算當前資料夾下所有檔案的大小

計算當前資料夾下所有檔案的大小

import os

temp1 = os.listdir('.')
temp2 = []

for each in temp1:
    temp2.append((each,os.path.getsize(each)))

temp3 = dict(temp2)
    
for i in range(len(temp2)):    
    print('%s 【%d】Bytes' % (temp1[i],temp3[temp1[i]]))