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
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
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 = 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
from PIL import Image
import numpy as np
import sys
import glob
import os
root_dir = sys.argv[1]
z = ",".join(f"'{n}'" for n in glob.iglob(root_dir + '/*.png', recursive=True))
print(z)
images = [", ".join(f"'{n}'" for n in glob.iglob(root_dir + '/*.png', recursive=True))]
images = [Image.open(path) for path in [z]]
FileNotFoundError: [Errno 2] No such file or directory: "'/Users/e/Desktop/1/4.png','/Users/Users/e/Desktop/1/5.png','/Users/Users/e/Desktop/1/2.png','/Users/Users/e/Desktop/1/3.png','/Users/Users/e/Desktop/1/1.png'"