I want a list of directories called sim1
, sim 2
, etc. created when a particular variable in my for loop is equal to 1, 2, etc.
I know that I have to use the os
package (specifically the os.makedirs()
function for directory creation) but have unfortunately not found the documentation pertaining specifically to this.
for n in np.arange(0,100):
os.makedirs('C:\\Users\\adeet\\Desktop\\'/n)
I tried the above code- got the error - unsupported operand type(s) for /: 'str' and 'float'
and when I tried this-
for n in np.arange(0,100):
os.makedirs('C:\\Users\\adeet\\Desktop\\n')
It made a folder named 'n' once and then gave me an error -[WinError 183] Cannot create a file when that file already exists: 'C:\Users\adeet\Desktop\n'