os.rename examples Example 1: rename file python import os os.rename('old_name.txt','new_name.txt') Example 2: os.rename os.rename(src, dst)