I want to code the examples shown below:
name = "Myname" status = "married" sex = "Male" color = {'eyeColor' : 'brown', 'hairColor' : 'golden', 'skinColor' : 'white'}
I use base64 encoding scheme and use syntax like <field-name>.encode('base64','strict') , where field-name consists of the above fields: name, status, etc.
Everything except the color dictionary is encoded. I get an error when color.encode('base64','strict')
The error is given below:
Traceback (most recent call last): color.encode('base64','strict') AttributeError: 'CaseInsensitiveDict' object has no attribute 'encode'
I think the encoding method is not suitable for a dictionary. How to encode a complete dictionary right away? Is there an alternative to the encode method that applies to dictionaries?
source share