I'm trying to create a folder using os.mkdir with looping on the list for example i Want 12 folders with name, January, February ... etc With this in the way many lines I could make folders I wanted. P> But with no looping to do it Thanks
import os om.mkdir ('D: \\ Python_GIS \' Jan ') os.mkdir (' D: \\ Python_GIS \\ ('D: \\ Python_GIS \' March ') OSMKDR ('D: \\ Python_GIS \ app') OSMKDR ('D: \\ Python_GIS \') '' OS Mkdir ('D: \\ Python_GIS \\ Jun') os.mkdir ('D: \\ Python_G IS \\ July ') os.mkdir (' D: \\ Python_GIS \\ Aug ') os.mkdir (' D: \\ Python_GIS \\ Sep ') os.mkdir (' D: \\ Python_GIS \\ Oct ' ) Os.mkdir ('D: \\ Python_GIS \\ Nov') os.mkdir ('D: \\ Python_GIS \\ December')
this os.path.join ( )
is a major task that adds logic to the system's separator. This is a great way to reduce errors related to \
.
Unrelated style Note: Try setting your path as a raw wire which will ignore the texts, so baseDir = r'D: \ Python_GIS '
Comments
Post a Comment