python是一款很强势的编程工具,很多朋友都想知道python怎么运行c盘文件,一起来看看吧。
import os
from os.path import join, getsize
for root, dirs, files in os.walk("c:\"):
fsum = 0
for name in files:
fname = join(root, name)
fsize = getsize(fname)
fsum += fsize
print("%s => %d" % (fname, fsize))
print("%s => %d" %(root, fsize))