Python中 代码创建文件夹

import os
import random
sentence = "You are a beautiful girl, I love you, I know you will be different six months later, enjoy the good time of the six months."

sentence = sentence.split( )

print sentence

def CreatDir():
    index =0
    for sub in sentence:
        path = "/Users/Scarlett/Desktop/SceretPaper/" + sub +  str(index)
        os.makedirs(path)
        index += 1

CreatDir()
以后就这样给我对象写小情书了

你可能感兴趣的:(Python)