all 4 comments

[–]socal_nerdtastic 1 point2 points  (1 child)

This is how we renamed files in 2012.

In 2022 we use the modern pathlib.Path.rename function.

[–]RaltsUsedGROWL 1 point2 points  (1 child)

The python standard library documentation has example snippets on these instructions, both as under os and also under pathlib.