Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

Look at the following code:

from IPython.display import Image

Image(filename='someimage.jpg')

Here, If the image is a part of the while loop, it's not at all loading.

But this does not work:

while True:

    Image(filename='someimage.jpg')

    break

I just want to know, How can I display several images from a list?

1 Answer

0 votes
by (26.4k points)

Look at the following code, it works fine

from IPython.display import display, Image

path1 = "/some/path/to/image1.png"

path2 = "/some/path/to/image2.png"

for path in path1, path2:

    img = Image(path)

    display(img)

Want to learn more about python, Come and join: Python training course

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Oct 8, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...