On Oct 18, 7:40 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Abandoned <[EMAIL PROTECTED]> writes: > > Sorry i can't understand :( > > Yes my database already has data in the "{..}" format and i select > > this and i want to use it for dictionary.. > > But, do you use Python to create that data? If so, simply convert it > to pickle binary format instead of "{...}". As explained in my other > post: > > > id-1 | all > > 56 {68:66, 98:32455, 62:655} > > If you use Python to create this cache table, then simply don't dump > it as a dictionary, but as a pickle: > > id-1 | all > 56 <some weird string produced by cPickle.dumps> > > When you load it, convert the string to dict with cPickle.loads > instead of with eval.
Yes i understand and this very very good ;) But i have a problem.. a=eval(a) a=pickle.dumps(a, -1) cursor.execute("INSERT INTO cache2 VALUES ('%s')" % (a)) conn.commit() and give me error: psycopg2.ProgrammingError: invalid byte sequence for encoding "UTF8": 0x80 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". -- http://mail.python.org/mailman/listinfo/python-list