When the program is running, the camera turns on and I create a folder for pictures taken from the camera. How can I do it?

datasets = & # 39; datasets & # 39;
for the sub-data in the interval (1,5):
if os.path.isdir ("/ datasets /" + str (sub_data)) == True:
path = os.path.join (dataset, str (sub_data))
otherwise os.path.isdir (path):
os.mkdir (path)
(width, height) = (130, 100)