What is the most elegant way to check if the directory a file is going to be written to exists, and if not, create the directory using Python? Here is what I tried:
Use this command check and create dir
if not os.path.isdir(test_img_dir): os.mkdir(test_img_dir)