1import os
2if not os.path.exists('my_folder'):
3 os.makedirs('my_folder')
4
5#You can also use the python idiom EAFP:
6#Easier to ask for forgiveness than permission. For example,
7
8try:
9 os.makedirs('my_folder')
10except OSError as e:
11 if e.errno != errno.EEXIST:
12 raise