1# Python program to create directory using os.makedirs() method
2
3import os
4
5# Directory path
6dir_path = "C:/Projects/Tryouts/test/sample/mydir"
7os.makedirs(dir_path)
8print("Directory '% s' created" % dir_path)
9
10
11# Directory path
12dir_path2 = "C:/Projects/Tryouts/test/sample/mydir2"
13# mode
14mode = 0o666
15os.makedirs(dir_path2, mode)
16print("Directory '% s' created" % dir_path2)
17
1# Python program to create directory using os.mkdir() method
2
3import os
4
5# Directory path
6dir_path = "C:/Projects/Tryouts/sample"
7os.mkdir(dir_path)
8print("Directory '% s' created" % dir_path)
9
10
11# Directory path
12dir_path2 = "C:/Projects/Tryouts/sample2"
13# mode
14mode = 0o666
15os.mkdir(dir_path2, mode)
16print("Directory '% s' created" % dir_path2)
17