I am trying to create a new folder at the location where the python script is saved and then create a new file inside that folder and write information to it. What would be the best way to create the folder and then the path for the file? Thanks a lot.
I used the following code to create the folder
import os
from os import path
nameofFolder = "TestFolder"
foldercheck = os.path.isdir(nameofFolder)
if foldercheck:
print('Folder present')
else:
os.makedirs(nameofFolder)
I tried using
completepath = os.path.join(nameofFolder +"/", fileName)
to create a path for the file but that keeps creating the file in the root directory.