Jun-12-2020, 09:01 AM
What it looks like you are trying to do is 'open' a directory to get all the images, so you can use them elsewhere.
I would recommend the glob module for that.
I would recommend the glob module for that.
import glob def open_train_data(): return glob.glob('/home/mojito/Desktop/CNN/datasets/training_data/images/*') #the '*' is a 'wildcard' and it means to match one or more characters for f in open_train_data(): dict1 = pickle.load(f) ###do whatever else you need to