oldMammuth

Authored Comments

Nice way you have for explaining programming to newbies! (I will shamelessly copy from this, you are warned!)
By the way, I too never make errors ;-) , it's always the interpreter fault! There should be something like WYSIWYM for scripting language...
Now, since the python interpreter has a WYSIWYG philosophy behind it, it is complaining about the extra ')' in the last script. Moreover, I guess you meant to have a '+filename[-4:]' (from the fourth-last till the end) instead of '+filename[:-4]' (from beginning till the fourth-last).
Again, thanks for this article, I'll show it to my little sis who's learning computer graphics just now: I think it'll help her.

the complete code of the last script should look like:
import os

for filename in os.listdir('./'):
if filename.endswith('0001.png'):
print('Renaming:', filename)
os.rename(filename, filename[:-8]+filename[-4:])