[Pickle]dirty problem 3 lines

bussiere bussiere bussiere at gmail.com
Wed Sep 1 09:02:51 EDT 2010


it's just as it seems :
i want to know how does ti works to get back an object from a string in python :
pickle.loads("""b'\x80\x03]q\x00(K\x00K\x01e.'""") #doesn't work
Google Fan boy



On Wed, Sep 1, 2010 at 5:23 AM, MRAB <python at mrabarnett.plus.com> wrote:
> On 01/09/2010 03:33, bussiere bussiere wrote:
>>
>> i know it's dirty, i know i should use json but i want to know, it's
>> quiet late here :
>> import pickle
>> dump = """b'\x80\x03]q\x00(K\x00K\x01e.'"""
>> print(pickle.loads(dump))
>>
>> how can i get back my object from this string ?
>> the string is :  b'\x80\x03]q\x00(K\x00K\x01e.'
>> and i'am using python3
>> help will be appreciated i'am chewing on this for a long time now.
>
> Well, pickle.loads(b'\x80\x03]q\x00(K\x00K\x01e.') works.
>
> That, of course, is not the same as """b'\x80\x03]q\x00(K\x00K\x01e.'""".
>
> Do you mean r"""b'\x80\x03]q\x00(K\x00K\x01e.'"""?
>
> (It's also late here, well, actually, so late it's early... Time to
> sleep. :-))
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list