In this article, we'll look at the knowledge of one of the directories in Python, first of which we'll look at how
python builds a directory , and only learn how to set up a directory and then in the next article I'll explain
how to modify the Python directory. .
Directory
All files are contained in different directories, but Python is also easy to handle. The OS module has many ways to help you create, delete, and change directories.
mkdir () method
You can use the mkdir () method of the OS module to create new catalogs in the current directory. You need to provide a parameter that contains the name of the directory you want to create.
Grammar:
Os.mkdir ("Newdir")
Example:
The following example creates a new catalog test under the current directory.
#!/usr/bin/python#-*-coding:utf-8-*-import os# Create directory Testos.mkdir ("test")