I would to serialize my object ancd encode() decode() it for manage byte/string format. I try creating this class:
class test(object):
def __init__(self,uid):
self.uid.uid
at this point instantiate the objest and serialize it:
inst_a = test(1)
pickle.dumps(inst_a)
return
b'\x80\x04\x95$\x00\x00\x00\x00\x00\x00\x00\x8c\x08__main__\x94\x8c\x04test\x94\x93\x94)\x81\x94}\x94\x8c\x03uid\x94K\x01sb.'
all done. Now i would transform from byte to string but when i do:
pickle.dumps(ins_a).decode()
i get
Traceback (most recent call last): File "<pyshell#11>", line 1, in pickle.dumps(a).decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
why thi appen? how can i decode/encode my serialized object for transform it from byte to string and vice versa?
So many thanks indeed