storing and retrieving images in dictionary - python -


can tell me how store images in dictionary, , how retrieve images dictionary based on key value.

thanks in advance!

it better store images in files , reference them filename:

pictures = {'mary': '001.jpg', 'bob', '002.jpg'} filename = pictures['mary'] open(filename. 'rb') f:     image = f.read() 

that said, if want store images directly in dictionary, add them:

pictures = {}  open('001.jpg', 'rb') f:      image = f.read() pictures['mary'] = image 

images aren't special, data.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -