In order to rename a file with Python, you can use the os.rename() function. Simply pass in both the source path to the file and the updated file path that you want to use. If the renamed file path already exists, then Python will raise a FileExistsError.