I have a list containing 10000 images. I want to show the 1st 10 images. How do I write the for loop in Python ?
from PIL import Image
import glob
image_list = []
for filename in glob.glob('<my_directory>*.pgm'):
im=Image.open(filename)
image_list.append(im)
import matplotlib.pyplot as plt
for i in range(10):
plt.figure()
plt.imshow(image_list[i])
That's my code. I have tried image_list(3), image_list(1:3) but it all doesn't work.