If I have folders with a number followed by an arbitrary title
1 - Dog
2 - Cat
3 - Frog
...
999 - Penguin
And in my code I have something like this (very stripped down)
num = 1
for x in range(100):
cv2.imwrite("C:/path/to/1 - Dog/%d.PNG" % x, image)
if x % 5 == 0:
num += 1:
Is there a way to put in the num variable in the input to cv2.imwrite() (currently "C:/path/to/1 - Dog/%d.PNG" % x) to allow my script to automatically switch folders to whatever the value of num is (every time a condition is met)?
The folder being saved to should always follow the value of num, where the value matches the number in the name of the folder.