博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python:使用 Pathlib 创建多级文件夹
阅读量:3612 次
发布时间:2019-05-21

本文共 132 字,大约阅读时间需要 1 分钟。

需求:使用 pathlib 创建多级文件夹。

pathlib.Path('./data').mkdir(parents=True, exist_ok=True)
  • parents = True: 创建中间级父目录
  • exist_ok= True: 目标目录存在时不报错

转载地址:http://scckn.baihongyu.com/

你可能感兴趣的文章
文件的读与写
查看>>
获取URL地址栏参数
查看>>
springboot日志
查看>>
springboot -- thymeleaf模板引擎的配置与使用
查看>>
springboot -- 利用WebMvcConfigurerAdapter页面对于单纯的跳转功能的简化配置
查看>>
springboot --前端网页引用jar包依赖的做法
查看>>
springboot --根据配置文件切换语言
查看>>
springboot -- 拦截器(HandlerInterceptor)
查看>>
springboot -- thymeleaf重新跳转时的bug
查看>>
springboot -- 前后端接收数据
查看>>
springboot -- 用@RerquestBody接收前端数据 ajax的写法
查看>>
springboot -- 后端接收前端字符串时间并且转换成Date
查看>>
springboot --前后端传输实体对象中引用对象无法被解析问题
查看>>
springboot -- 异常错误页面初了解
查看>>
springboot -- 自定义(可预知和不可预知) Exception 异常的抛出和统一捕获处理
查看>>
连接mysql 出现:java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.
查看>>
springboot --Mybatis注解版和配置文件版
查看>>
springboot -- JPA简单运用
查看>>
springboot -- 自定义starter
查看>>
springboot -- Cache缓存初了解
查看>>