return path of created folders python code example
Example 1: python get current file location
import os
os.path.dirname(os.path.abspath(__file__))
Example 2: create a directory python
#creates a directory without throwing an error
import os
def create_dir(dir):
if not os.path.exists(dir):
os.makedirs(dir)
print("Created Directory : ", dir)
else:
print("Directory already existed : ", dir)
return dir