Reputation: 177
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?
Upvotes: 0
Views: 918
Reputation: 2692
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.
Upvotes: 2