[Tutor] how to extract number of files from directory

Kent Johnson kent37 at tds.net
Wed Oct 12 22:17:30 CEST 2005


Alan Gauld wrote:
> a = len(os.listdir(mydir, '*JPG')
> 
> Should be about right...

No, os.listdir() only takes one argument, the directory. See the solutions with glob.glob().

Kent



More information about the Tutor mailing list