z = 1
......
for root, dirs, files in os.walk(root_dir + str(images[z])):
for file in files:
if file.endswith(".png"):
res.append(os.path.join(root, file))
images = [Image.open(path) for path in res]
......
range
забыл. Или не знал. z = 1
try:
for root, dirs, files in os.walk(root_dir + str(images[z])):
for file in files:
if file.endswith(".png"):
res.append(os.path.join(root, file))
images = [Image.open(path) for path in res]
z+=1
except Exception as e:
print(e)
continue
количество_повторений_действий = 10
for z in range(1, количество_повторений_действий):
for root, dirs, files in os.walk(root_dir + str(images[z])):
for file in files:
if file.endswith(".png"):
res.append(os.path.join(root, file))
images = [Image.open(path) for path in res]
for root, dirs, files in os.walk(root_dir + str(images[z1])):
for file in files:
if file.endswith(".png"):
res.append(os.path.join(root, file))
images = [Image.open(path) for path in res]
for root, dirs, files in os.walk(root_dir + str(images[z2])):
for file in files:
if file.endswith(".png"):
res.append(os.path.join(root, file))
images = [Image.open(path) for path in res]
for root, dirs, files in os.walk(root_dir + str(images[z3])):
for file in files:
if file.endswith(".png"):
res.append(os.path.join(root, file))
images = [Image.open(path) for path in res]
z = 0
images = ['a', 'b', 'c']
a = len(images)
print(a)
i= 0
for c in "educative":
if a > z:
z+=1
print(z)
if z >=a:
print('perehodim_k_sled_bukve')
z = 0
continue
3
1
2
3
perehodim_k_sled_bukve
1
2
3
perehodim_k_sled_bukve
1
2
3
perehodim_k_sled_bukve
images = []
res = []
z = 1
i = 0
with open('data.csv', 'rt', encoding='utf-8') as src:
reader = csv.reader(src)
for row in reader:
fname = row[1]
images.append(fname)
a = len(images)
print(a)
root_dir = sys.argv[1] + str(images[a-z])
print(root_dir)
print('Folder count', a)
for root, dirs, files in os.walk(root_dir):
for file in files:
if file.endswith(".png"):
res.append(os.path.join(root, file))
for c in "educative":
if a > z:
z+=1
print(z)
if z >=a:
print('max count')
z = 0
continue
images = ['a', 'b', 'c']
a = len(images)
print(a)
for c in "educative":
print(f'perehodim_k_sled_bukve {c}')
for i in range(a):
print(f'буква {c} цикл {i} image {images[i]}')