I want to make Python code to make a new directory then put you into it, same as typing md and cd yourself, but only one command typed. I can use os.chdir() but after Python program exits I return to original directory, not going to new one. How do I change directory and stay there after exit?

Since you enter the Python interpreter, run the program, and then exit the interpreter, I don't think there is a way. The interpreter will always return you to the original directory when it exits. Perhaps someone else will have other ideas on this.

Your code would have to have its own configuration file that it stores the default directory in and then loads on entry.

Jeff

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.