Skip to content
Advertisement

Python – How do you display base64 images during a for loop in Jupyter Notebook?

I’m trying to display a list of dicts where one of the keys is to a base64 string.

So far, I have been unable to display the base64 strings as images during a for loop and not within a DataFrame.

My code:

JavaScript

Unfortunately, while this works on a single code cell running a single base64 string, it does not show any image during the for loop.

JavaScript

This also fails to show any image:

JavaScript

How can I get the base64 strings to display properly during the loop?

Advertisement

Answer

You’re missing a call to IPython.display.display:

enter image description here

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement