How do I get number of files in a particular directory.

Cameron Simpson cs at zip.com.au
Fri Aug 13 04:51:11 EDT 2010


On 13Aug2010 00:54, blur959 <blur959 at hotmail.com> wrote:
| Hi, all, Is there a way to get a number of files in a particular
| directory? I tried using os.walk, os.listdir but they are return me
| with a list, tuple of the files, etc. But I want it to return a
| number. Is it possible?

Measure the length of the list returned to you? The len() built in
function suggests itself...
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/



More information about the Python-list mailing list