I\'m fairly new when it comes to programming, and have started out learning python.
What I want to do is to recolour sprites for a game, and I am given the original
os.listdir() returns a list of file names. Thus, filename
is a string. You need to open the file before iterating on it, I guess.
Also, be careful with backslashes in strings. They are mostly used for special escape sequences, so you need to escape them by doubling them. You could use the constant os.sep
to be more portable, or even use os.path.join()
:
folder = os.path.join('C:\\', 'Users', 'Sprinting', 'blue')