Last active
November 1, 2015 01:27
-
-
Save m-note/db3f07bca84ebd97cf1d to your computer and use it in GitHub Desktop.
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 sys | |
import os | |
import re | |
if __name__ == "__main__": | |
folder = input("Folder pass: ") | |
file_list = os.listdir(folder) | |
os.chdir(folder) | |
for file in file_list: | |
pattern = re.compile(r".csv") | |
if pattern.search(file): | |
name_temp = file[ : -7] # "_p1.csv"となっているところを置き換えるので、それを除く | |
new_name = name_temp + "_p2.csv" | |
os.rename(file, new_name) | |
else: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment