Looks good. Thanks.
Eric Dorsey wrote:
>>> config_names = {'start_time': '18:00:00',
'gray_scale': True, 'long': 120.0}
>>> config_names
{'start_time': '18:00:00', 'gray_scale': True, 'long': 120.0}
>>> for i, x in config_names.items():
... print i, x
...
start_time 18:00:00
gray_scale True
long 120.0
>>>
On Wed, Feb 11, 2009 at 7:48 PM, Wayne
Watson <[email protected]>
wrote:
I have a dictionary that
looks like:
config_names = {"start_time : '18:00:00', 'gray_scale' : True, "long":
120.00}
If I iterate over it, the entries will appear in any order, as opposed
to what I see above. However, in the config file, I'd like to keep them
in the order above. That I want to write the config file in order.
Perhaps, I need a list like c_names = ["start_time", "gray_scale",
"long"] to get the keys out in the order I need? Maybe there's another
way?
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
The Richard Feynman
Problem-Solving
Algorithm:
(1) write down the problem;
(2) think very hard;
(3) write down the answer.
Web Page: <www.speckledwithstars.net/>
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor
--
Signature.html
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
The Richard Feynman Problem-Solving
Algorithm:
(1) write down the problem;
(2) think very hard;
(3) write down the answer.
Web Page: <www.speckledwithstars.net/>
|
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor