I want to encode the sample stuff shown below:
name = "Myname"
status = "married"
sex = "Male"
color = {'eyeColor' : 'brown', 'hairColor' : 'golden', 'skinColor' : 'white'}
I am using base64 encoding scheme and used syntax as <field-name>.encode('base64','strict')
where field-name
consists of above mentioned fields- name, status and so on.
Everything except dictionary "color" is getting encoded.
I get error at color.encode('base64','strict')
The error is as shown below:
Traceback (most recent call last):
color.encode('base64','strict')
AttributeError: 'CaseInsensitiveDict' object has no attribute 'encode'
I think encode method is not appicable on dictionary.
How shall I encode the complete dictionary at once?
Is there any alternative to encode
method which is applicable on dictionaries?