Home  >  Article  >  Backend Development  >  How to use the mkdir method in python

How to use the mkdir method in python

silencement
silencementOriginal
2019-05-24 13:58:4511376browse

Usage of the mkdir method in python: [os.mkdir(path[, mode])]. The os.mkdir() method is used to create a directory in digital permission mode. The default mode is 0777. This method has no return value.

How to use the mkdir method in python

The os.mkdir() method is used to create a directory in digital permission mode. The default mode is 0777 (octal).

The syntax format of the mkdir() method is as follows:

os.mkdir(path[, mode])

The parameters :path -- the directory to be created, mode -- the permission numeric mode to be set for the directory

Return value:

There is no return value for the modified method

The following example demonstrates the use of the mkdir() method:

How to use the mkdir method in python

The output result of executing the above program is:

目录已创建

The above is the detailed content of How to use the mkdir method in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn