Create directory

How do i create directory in C: drive (or) D: drive. I have used python script and Java, but i was not able to create directory, i got syntax error. Please help me out.

Python script :

import os


Java :

using* import File

f = new File(“D:/hello”)

In java the return type is boolean. How do i assign the directory created to a variable.

Try this:

import os
dir = "C:\TEST_MAKE"
if not os.path.exists(dir):

Can i do like this (assign it to a variable)

dirs = os.makedirs(dir)

No you can’t do that. os.makedirs() doesn’t return anything. Why do you want to assign the directory to a variable (you want a directory object?)? If you give me an idea of what you’re trying to accomplish I might be better able to help.

The code worked fine. I was able to accomplish the task. I did not have the need to the assign the directory to a variable.

Thanks for the help.