directory structure - Python Create a Folder -
i have folder named d:\myfolder\subdir1\subdir2 contains file named garbage. how create folder under same directory named garbage? script not working, receiving error oserror: [errno 17] file exists: 'd:\myfolder\subdir1\subdir2\garbage'. here code snippet:
if os.path.exists(newloc): print('exists ', newloc) if not os.path.isdir(newloc): print('create ', newloc) os.makedirs(newloc) else: print('creating ', newloc) os.makedirs(newloc)
Comments
Post a Comment