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 -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -