Last active
August 31, 2016 01:18
-
-
Save chchwy/5819921 to your computer and use it in GitHub Desktop.
Python 批次修改檔名
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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