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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -