简体   繁体   中英

Count number of files with .py extension using python function

我是python的新手,我试图弄清楚我们编写函数的方式,该函数可以递归计算指定目录中python文件(.py扩展名)的数量。

Why do you want to do that? You could just do find -iregex .*.py on any linux box.

Alternatively you could import walk from os and use it to walk a directory and check the last 3 characters of each file name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM