本文介绍了Python中的内部目录计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i want to make code using python from which i can count the directories which is in a directory and the files in it.i am getting number of files and filenames by using listdir() function and count also by using len(data) function.but i have directories in a directory & in that i have files. i am using below code.<br>please guide me for that
<pre><br>

ans =(Dir_name 56)的例子



我尝试过:



example of ans=(Dir_name 56)

What I have tried:

import os
img_folder_path = ("C:/Users/Uname/Desktop")
dirListing = os.listdir(img_folder_path)
  print(dirListing)
  print(len(dirListing))

推荐答案



这篇关于Python中的内部目录计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 12:59