[Tutor] how to extract number of files from directory

Alan Gauld alan.gauld at freenet.co.uk
Wed Oct 12 23:49:56 CEST 2005


>> 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().

Oops! Quite right, my mistake. (As is the missing right paren!)

Alan g. 



More information about the Tutor mailing list