Create Multiple Folder on Python
Create Multiple Folder
Python
Hi Programmers..
Again i show interesting code to you..
Here I have show you how to create 'n' of folder
{n - Depends on your wish, n means number}
Copy that Py Code and Paste Below mention website and run it...
website: https://repl.it/languages/python3
Again i show interesting code to you..
Here I have show you how to create 'n' of folder
{n - Depends on your wish, n means number}
Copy that Py Code and Paste Below mention website and run it...
website: https://repl.it/languages/python3
CODE 1:
from pathlib import Path
i = 1
while i <= 10:
path1 = Path(f"dummy{i}")
print(path1.mkdir())
i += 1
i = 1
while i <= 10:
path1 = Path(f"dummy{i}")
print(path1.mkdir())
i += 1
CODE 2:
Here we have create folder with name through array string value...
-----
from pathlib import Path
ar = ['raj','karthick','jack','sam','sasi']
n = len(ar)
for i in range(n):
path1 = Path(ar[i])
print(path1.mkdir())
------
ar = ['raj','karthick','jack','sam','sasi']
n = len(ar)
for i in range(n):
path1 = Path(ar[i])
print(path1.mkdir())
------
Bonus:
if you want create array with numbers of string,
use below code
use below code
-----
n = int(input())
ar = []
for i in range(n):
a = input()
ar.append(a)
ar = []
for i in range(n):
a = input()
ar.append(a)
-----
Let's enjoy with this code..
By
PyKar
Comments
Post a Comment