Created
July 27, 2018 10:34
-
-
Save dukn/fe0523f8be7bce26faeeaf6d2c3bbce5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def count(path): | |
ld = os.listdir(path) | |
#print (ld) | |
result = 0 | |
for name in ld: | |
if os.path.isdir(path+'/'+name): | |
#print (name) | |
ld2 = os.listdir("{}/{}/".format(path,name)) | |
result += len(ld2) | |
else: | |
result += 1 | |
return result | |
def check(): | |
ld = os.listdir() | |
if __name__ == '__main__': | |
ar = [] | |
for dr in os.listdir("./"): | |
if os.path.isdir(dr): | |
ar.append([count(path=dr),dr]) | |
ar = sorted(ar ,key=lambda x:x[0]) | |
for b,a in ar: | |
print (a,':',b) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment