I needed to learn how to create directories using Python and found this great resource (digression: check out this author’s page headers - way cool!)

Although I didn’t really add anything new to the code, I ended up creating the following commented function which I share here in case it helps more users to understand.

# If directory (path) doesn't exist, create it
def createPath(path):
    if not os.path.isdir(path):

# Example of Windows file path
createPath( "C:\\Python\\myNewDirectory" )

# Example of Linux file path
createPath( "/home/username/myNewDirectory" )