0

I have the following code:

import os

os.system(cd new_folder)

Now, this code changes the directory to the "new_folder" folder, but what I want to do is make the directory stay in that state so I can conduct another line of code, such as the following:

import os

os.system(cd new_folder)
os.system(md good_folder)

What I intend to do in the above is after I move inside the "new_folder" folder directory, I make another folder named "good_folder" inside the "new_folder" folder.

But I can't seem to find a way to make the directory stay in the same place... how can this be done?

1 Answer 1

2

You can have multiple commands separated by semicolons. In your case it would look like:

import os

os.system("cd someFolder; mkdir newFolder")

Refer to this thread for further explanation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.