1 import os
2 def mkdir(path):
3 folder=os.path.exists(path)
4 if not folder:
5 os.makedirs(path)
6 print(path+"---OK---")
7 else:
8 print(path+"---There is this folder!---")
9
10 if __name__=='__main__':
11
12 with open('D:\input.txt', ' R & lt ' ) AS F:
13 is Lines = f.readlines ()
14 for Line in Lines:
15 Folder = Line
16 # Strip () method removes the specified character string head and tail
. 17 Folder = folder.strip ()
18 is # Print (Folder)
19 mkdir (Folder)
In the D root directory create a file input.txt, which branches enter the directory name on the line