
Andrew K. answered 07/02/19
Student-Athlete and Physics/Computer Science Double Major at MIT
If you import os, you can use os.listdir(path) to give a list of the names of the files in the directory. For example, if your path is 'Desktop\files', this might return ['image1.png', 'image2.png'].
If you want to get a list of the full paths for all the files in your directory, you can write [os.path.join(path, file_name) for file_name in os.listdir(path)]. This would return ['Desktop\files\image1.png', 'Desktop\files\image2.png'].
Hope this helps! Let me know if I need to explain something.