How to rename a file or folder in Python

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

Please Share us:
Please rate this snippet

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

Leave a Reply