[Python] OS.rename creates a file but doesn't rename the existing file?

Discussão em 'Python' iniciado por Stack, Maio 26, 2025.

  1. Stack

    Stack Membro Participativo

    I tried to rename my existing file, "test.py" to "test1.py". It just creates a new file called "test1.py" instead of renaming "test.py" to "test1.py".

    My code is below.

    import os
    os.rename("test.py", "test1.py")

    Continue reading...

Compartilhe esta Página