Load in images from file python pygame
Question: I'm working on a pygame project, and in my main directory I have a folder
called "Sprites" for example. Is there a way using python to load all the
images in that file into a list? I know how to put things in list using a for
loop, I'm just not sure if there is a way to go through a folder's images and
load them into a pygame sprite. I also know that if the images were all named
the same with a number following them, I could concatenate a string, but what
if they had completely different names?


Answer: Use the os module to list the files of a directory; it will return a list

    
    
    import os
    fileList = os.listdir("path")
    

More details: <http://docs.python.org/2/library/os.html#os.listdir>

