'HTML show image if it exists and show nothing if it doesn't

I need to display an image on my HTML page but only if it exists on my computer (aka i give it a path and it checks). If it doesn't, then show nothing. How can I write a function that checks if the image exists, then if yes, display it if no, don't show anything? I am using django as a back end.



Solution 1:[1]

I think you should try os.path.exist

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitry