I am looking for some advice as to the best way to generate a file path using variables, currently my code looks similar to the following:
path = /my/root/di
Yes there is such a built-in function: os.path.join.
>>> import os.path >>> os.path.join('/my/root/directory', 'in', 'here') '/my/root/directory/in/here'