On Oct 18, 7:02 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Abandoned <[EMAIL PROTECTED]> writes: > > 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 ?? > > Because you gave it a string. If you give it a dict, you'll get a > dict: > > >>> import cPickle as pickle > >>> a = {1:2, 3:4} > >>> s = pickle.dumps(a, -1) > >>> g = pickle.loads(s) > >>> g > > {1: 2, 3: 4} > > If your existing database already has data in the "{...}" format, then > eval it only the first time. Then you'll get the dict which you can > cache thruogh the use of dumps/loads.
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.. in your example: first data is a string finally data is already string I want to command like eval. (eval is not good because it is slow for my project) -- http://mail.python.org/mailman/listinfo/python-list