def getdirsize(dirpath): size = 0 for root, dirs, files in os.walk(dirpath): size += sum([getsize(join(root, name)) for name in files]) return size
def getdirsize(dirpath): size = 0 for root, dirs, files in os.walk(dirpath): size += sum([getsize(join(root, name)) for name in files]) return size
转载于:https://www.cnblogs.com/sea-stream/p/10209083.html