Last active
August 3, 2018 13:19
-
-
Save ayuLiao/4fd0da374d2b9d62659bed097e6cb911 to your computer and use it in GitHub Desktop.
python统计文件夹中的文件数
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 | |
DIR = '/tmp' #要统计的文件夹 | |
print(len([name for name in os.listdir(DIR) if os.path.isfile(os.path.join(DIR, name))])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment