OS 创建多个文件夹
Posted 都一样
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OS 创建多个文件夹相关的知识,希望对你有一定的参考价值。
import requests import os import json url=‘https://pvp.qq.com/web201605/js/herolist.json‘ html=requests.get(url) html_json=html.json() B=list(map(lambda x:x[‘ename‘],html_json)) N=list(map(lambda x:x[‘cname‘],html_json)) #N=html_json[0][‘cname‘] #P=html_json[0][‘‘] #print(B,N) def MKdir(name): C=‘F:/WZRY/‘#盘符 当不输入盘符是默认在当前文件保存位置创建 name=str(C)+str(name)+‘/‘ da=os.path.exists(name) if not da: os.makedirs(name) print(str(name)+"创建成功!") return str(name) else: print("已存在,未创建!") return False #name=MKdir(N) for x in N: #root=MKdir(x) print(x)#创建文件夹 #for i in B: # print(i) #getimg(i,i,root) #root=‘F:/WZRY/‘
以上是关于OS 创建多个文件夹的主要内容,如果未能解决你的问题,请参考以下文章