Jupyter显示几张图像[重复]

我有一个图像网址列表,并希望在Jupyter中显示它们。 由于可以使用一张图像,所以在列表上循环时不会显示任何图像:

这是清单:

liste_images = ['http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=447344&type=card',
 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=450248&type=card',
 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=447345&type=card',
 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=450252&type=card',
 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=469854&type=card',
 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=466953&type=card',
 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=469851&type=card',
 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=461108&type=card',
 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=461109&type=card',
 'http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=461107&type=card']

和我尝试的方式:

import requests
from IPython.display import Image
for url_image_carte in liste_images:
    Image(requests.get(url_image_carte).content)

Finally, the image from Jupyter session (individual image rendering is OK): enter image description here

评论
  • USA
    USA 回复

    Just use IPython.display.display like so:

    import requests
    from IPython.display import Image, display
    for url_image_carte in liste_images:
        display( Image(requests.get(url_image_carte).content) ) #added display