Oct-28-2022, 01:56 AM
Hi Team,
how to apply r(raw string) for a variable path
r"\\IND200300400.XXX.XXXX.XXX\Recon Project\output1" ---------here directly attached r its ok.
folderpath = \\IND200300400.XXX.XXXX.XXX\
path = r(folderpath)?...... how to apply r for variable. if user pass variable.
how to apply r(raw string) for a variable path
r"\\IND200300400.XXX.XXXX.XXX\Recon Project\output1" ---------here directly attached r its ok.
folderpath = \\IND200300400.XXX.XXXX.XXX\
path = r(folderpath)?...... how to apply r for variable. if user pass variable.
def createfolder(folderpath,site): Constant_folder = r{folderpath} Constant_folder = r(folderpath) path = f"{Constant_folder}\{site}" try: os.makedirs(path, exist_ok=True) print("Directory '%s' created successfully" % path) except OSError as error: print("Directory '%s' can not be created") if __name__ == "__main__": folderpath = "\\IND200300400.XXX.XXXX.XXX\Recon Project\output1" site = "US" createfolder(folderpath, site)