python 新建文件夾

import os
pathname = r'G:\work\2.purchaseInterest\data'

if not os.path.isdir(pathname):
    os.mkdir(pathname)
for i in range(10):
    subname = pathname+'\\'+"u%d"%i
    if not os.path.isdir(subname):
        os.mkdir(subname)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章