On Sat, Feb 7, 2009 at 3:20 PM, Wayne Watson <sierra_mtnv...@sbcglobal.net> wrote: > Is it possible to do some thing like this with exec: > > dcon0 = {'long':120.00, 'lat': 39.00, 'year': 2009} > > Can I use exec or eval simply on this to get: > long = 120.00 > lat = 39.00 > year = 2009 > > That is, initialize each of these three variables.
Yes, without exec: long = dcon0['long'] etc. but why? If you know the keys, you can hard-code the assignments as above. If you don't know the keys, you are probably better off leaving the values in the dict. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor