How To Make Directory in Python?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/make-directory-python/
PINTEREST
PINTEREST
INSTAGRAM

Python provides different functions and libraries for operating system related operations. Creating new directory or directories is very popular thing amongst developers. In this tutorial we will look how to create and make directory in PYthon.

Using OS Library with Mkdirs Function

Python provides os library which is mainly used for Operating system related operations. We will use mkdirs function by providing the directory name. In this example we will create a directory named myfile in the current working directory.

Provide Absolute Path

During a directory creating given file with named will be created in the current working directory. Current working directory is the path where the application or interactive console run. This situations may cause errors some time. We can prevent this errors and use more specific directory and path by providing absolute path.

In this example we will create a directory named myfile3 in the path /home/ismail/

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/make-directory-python/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  Linux Scp Command Usage With Eamples

Leave a Reply

Your email address will not be published.