Karthick
Karthick

Reputation: 695

Create Folder structure on MAC using python

In windows I run my tests and the framework will create the folders "C:\SAF\OutputData\Screenshots" and will save all the screenshots.

But, How can I create a equivalent Folder structure \SAF\OutputData\Screenshots on MAC using python?

Upvotes: 0

Views: 2308

Answers (1)

fjarri
fjarri

Reputation: 9726

Same as in Windows, by using os.makedirs. Note that:

  • OSX uses forward slash (/) as the path delimiter. You can use os.path.join to make this part of your code platform-independent.
  • While you can create a directory in the root of the filesystem, if you want to, it is discouraged. I am guessing that for your specific purpose you should use your home directory.

Upvotes: 1

Related Questions