[Tutor] how do i open picture files without knowing the file name?

Alan Gauld alan.gauld at yahoo.co.uk
Tue May 16 15:51:53 EDT 2017

On 16/05/17 19:49, Michael C wrote:
> I am running this code so I can do some image manipulation with them.
> The thing is, I have a lot of pictures to go through, so I can't type the
> file names

Do you know the folder where they live?
If so os.listdir() will give you a list of filenames.
If there are subfolders then os.walk() will traverse them.

If you don't understand that come back with more specific
questions about what puzzles you and we will expand
as necessary.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list