To rename a file or folder in Python you can use the following snippet.

Sample Python

import os
os.rename("pathOld","pathNew") #file or folderpaths

3 thought on “How to rename a file or folder in Python”

Leave a Reply