Convert string to command..

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Thu Oct 18 19:29:36 CEST 2007


Abandoned a écrit :
> On Oct 18, 6:51 pm, Marc 'BlackJack' Rintsch <bj_... at gmx.net> wrote:
>> On Thu, 18 Oct 2007 08:41:30 -0700, Abandoned wrote:
>>> import cPickle as pickle
>>> a="{2:3,4:6,2:7}"
>>> s=pickle.dumps(a, -1)
>>> g=pickle.loads(s);
>>> print g
>>> '{2:3,4:6,2:7}'
>>> Thank you very much for your answer but result is a string ??
>> In Python terms yes, strings in Python can contain any byte value.  If you
>> want to put this into a database you need a BLOB column or encode it as
>> base64 or something similar more ASCII safe.
>>
>> Ciao,
>>         Marc 'BlackJack' Rintsch
> 
> '{2:3,4:6,2:7}' already in database, i select this and convert to real
> dictionary..

MVHO is that whoever uses a RDBMS to store language-specific serialized 
collections should be shot down without sommation.




More information about the Python-list mailing list