Python os.mkdir() 方法

Python 教程 · 2019-02-04 07:26:41

概述

os.mkdir() 方法用于以数字权限模式创建目录。默认的模式为 0777 (八进制)。

语法

mkdir()方法语法格式如下:

os.mkdir(path[, mode])

参数

  • path -- 要创建的目录

  • mode -- 要为目录设置的权限数字模式

返回值

该方法没有返回值。

实例

以下实例演示了 mkdir() 方法的使用:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import os, sys

# 创建的目录
path = "/tmp/home/monthly/daily/hourly"

os.mkdir( path, 0755 );

print "目录已创建"

执行以上程序输出结果为:

目录已创建

点击查看所有 Python 教程 文章: https://www.codercto.com/courses/l/8.html

查看所有标签

Java Message Service API Tutorial and Reference

Java Message Service API Tutorial and Reference

Hapner, Mark; Burridge, Rich; Sharma, Rahul / 2002-2 / $ 56.49

Java Message Service (JMS) represents a powerful solution for communicating between Java enterprise applications, software components, and legacy systems. In this authoritative tutorial and comprehens......一起来看看 《Java Message Service API Tutorial and Reference》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试