Create directory in python

I am trying create a directory in python But it showing a message
can’t open file ‘create_directory’: [Errno 2] No such file or directory

First of all, i write some code inside create_directory.py file.
Here is those code:

import os

dir_name = "dimik_pub"
os.mkdir(dir_name)

i save this and run this in terminal using ,

python3 create_directory

Then it it says, can’t open file ‘create_directory’: [Errno 2] No such file or directory

Why like that :frowning: ?
If i run those code in terminal then it works perfectly.But when i write this inside a file then run this , it showing this message.

You’re using the file name without the extension .py, it should be python3 create_directory.py.

1 Like

Thank you so muchh :smiling_face_with_three_hearts: :sparkling_heart:

1 Like