I am trying to mass produce folders that would be numbered 0,1,2...
I use os.makedirs()
in Python to do so. It works if I am just creating a single folder, but when I use a for
loop for mass production something weird happens.
When I open Finder (file browser in Mac), I don't see the folder there. Yet when I type in the folder's path in Mac's Go box ( cmd-shift-G ), then it magically appears, which means that the folder actually exists but was invisible for some reason.
Does anyone know why the folders are invisible?
import os
for i in range(3):
os.makedirs('/Users/Olivia/code/'+str(i))
I apologise if I'm interpreting the question wrong, but if you are saying that the folders cannot be seen on the desktop, I found that the folders are saved in your home ( '/Users/Olivia'
in your case) folder, so if you want to save the folders in your desktop, then you can do:
import os
for i in range(3):
os.makedirs("/Users/Olivia/Desktop/code/"+str(i))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.