Skip to content

Instantly share code, notes, and snippets.

@chchwy
Last active August 31, 2016 01:18
Show Gist options
  • Save chchwy/5819921 to your computer and use it in GitHub Desktop.
Save chchwy/5819921 to your computer and use it in GitHub Desktop.
Python 批次修改檔名
import os
for filename in os.listdir('.'):
new_filename = filename.replace("OldStr", "NewStr")
os.rename(filename, new_filename)
print("{0} => {1}\n".format(filename, new_filename))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment