the full error message is : PermissionError: [Errno 13] Permission denied: 'F:/PetImages/train/Dog'
and the code is :
train_dir = 'F:/PetImages/train' test_dir = 'F:/PetImages/test'
train_dogs = ['F:/PetImages/train/{}'.format(i) for i in os.listdir(train_dir) if 'Dog' in i] train_cats = ['F:/PetImages/train/{}'.format(i) for i in os.listdir(train_dir) if 'Cat' in i]
test_img = ['F:/PetImages/test/{}'.format(i) for i in os.listdir(test_dir)]
train_imgs = train_dogs[:200] + train_cats[:2000]
random.shuffle(train_imgs)
import matplotlib.image as mpimg for ima in train_imgs[0:3]: img = mpimg.imread(ima) imgplot = plt.imshow(img) plt.show()