감동, 마음이 움직이는 것

[Python] count file numbers in the folder 본문

Tips (Utility, Computer Language, and etc.)

[Python] count file numbers in the folder

Struggler J. 2017. 8. 16. 03:29

[Ref] https://stackoverflow.com/questions/2632205/how-to-count-the-number-of-files-in-a-directory-using-python


import fnmatch

print len(fnmatch.filter(os.listdir(dirpath), '*.txt'))