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?

Sihwan Lee
  • 179
  • 2
  • 10

1 Answers1

1

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.

Rustam Garayev
  • 2,632
  • 1
  • 9
  • 13