
Pythonで
・ファイル名を変更
できます!
コード
ここでは例として
・デスクトップ配下にあるファイル「aiueo.txt」のファイル名を
・「newFileName.txt」へ変更
します。
※デスクトップ上に下記コードを記載した「sample.py」を作成します。

"""ファイル名を変更"""
import os
# 変更前のファイルパス
file_path = r'C:\Users\lunch\Desktop\aiueo.txt'
# 変更後のファイル名
new_file_path = r'C:\Users\lunch\Desktop\newFileName.txt'
try:
# ファイル名を変更
os.rename(file_path, new_file_path)
except OSError as e:
print(e)
実行結果
ファイル名を変更できました。
※ファイル名を「aiueo.txt」から「newFileName.txt」へ変更できました。


参考
上記で使用した以下の詳細は、公式サイトをご確認ください。
●標準ライブラリ「os」モジュールの「rename」