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
Post a Comment