Skip to content

Instantly share code, notes, and snippets.

@KatagiriSo
Created October 22, 2020 11:35
Show Gist options
  • Save KatagiriSo/c5a2f8a3ede7a7ebaaf82717eb33fcb9 to your computer and use it in GitHub Desktop.
Save KatagiriSo/c5a2f8a3ede7a7ebaaf82717eb33fcb9 to your computer and use it in GitHub Desktop.
ファイル名加工
import glob
import os
import re
paths = glob.glob("./*.*.json")
for path in paths:
file = os.path.basename(path)
pattern = r".*\.(.*\.json)"
m = re.findall(pattern,file)
os.rename(path, "./"+m[0])
print(m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment