Python Tutorials

Create Folder With Python

Hello Guys,

In this Python Tutorial, We are going to learn how to create a folder inside some folder with Python.

Some People Create Folder Using “Right Click > New > Folder “, Some Create Folder Using ShortCut “ctrl+shift+N

But there is an Advanced way in Python to create Folder. Yes, you heard me right!

With No Delay Let’s Get Started.

First Create Python File Somewhere in your Laptop.

Now Open the Python file in Editor Mode. Start writing this code.

import os 
	

directory = "Folder Created With Python"
	
parent_dir = "C:\\Users\\Ramesh Naidu\\Desktop\\Code World\\Python Tutorials"
	
path = os.path.join(parent_dir, directory) 
	
os.makedirs(path) 
print("Directory '% s' created" % directory)

Here directory means Folder name that your are creating with this Script. So Change it as you want

Note: Change parent_dir path to your own.

That’s it Now you can Create a Folder just at One Click

KSR

Hi there! I am the Founder of Cyber World Technologies. My skills include Android, Firebase, Python, PHP, and a lot more. If you have a project that you'd like me to work on, please let me know: contact@cyberworldtechnologies.co.in

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button