Create a directory if it does not exist in Python

Example of how to create a directory in Python:logo python

import os

directory = "/Users/diego/test/"

try:
  os.stat(directory)
 except:
  os.mkdir(directory)