We can use OS module in python provides functions for interacting with the operating system and provides a portable way to use operating system specific functionality. We can go to the current working directory with
os.getcwd () and rename the files with the
os.rame () method
os.rame () .
Below is the Python implementation: