View files in the directory D:
Create a directory using the os module, the code is as follows:
= R & lt path " D: \ A \ B " isExists = os.path.exists (path) Print (isExists) IF Not isExists: # path does not exist, i.e., the file name does not exist os.mkdir (path)
Then ........... FileNotFoundError: [WinError 3] path system not specified. : 'D: \\ a \\ b'
After a struggle, and finally found: D disk is simply not a directory, and create b directory under a directory, the system will error. So in the current directory, you can not create subdirectories and Sun directory. Correct wording is as follows;
= R & lt path " D: \ A " os.mkdir (path) path = R & lt " D: \ A \ B " isExists = os.path.exists (path) Print (isExists) IF Not isExists: # path does not exist, i.e., file name does not exist os.mkdir (path)
This deposit is pure Xueyibujing question, write this blog post is just to remind myself to seriously study. There have problems do not panic, patience, look at the code, check out the information, will always find a solution.