[Python] Change current working directory of the terminal in Python

Discussão em 'Python' iniciado por Stack, Fevereiro 11, 2025.

  1. Stack

    Stack Membro Participativo

    I am aware of the os.chdir() function and unfortunately it's not what I need.

    I have a Python script that does stuff, including creating a folder new_folder. I am running this script from a terminal (it is added to the PATH)

    C:\users\me\Desktop> my_script


    and I want it to change the current working directory of my terminal, like this:

    C:\users\me\Desktop> my_script
    C:\users\me\Desktop\new_folder>


    Is this even possible? And if so, how can I do it?

    Continue reading...

Compartilhe esta Página