On 11/01/07, Andrew Robert <[EMAIL PROTECTED]> wrote:
> Only some of the key/value pairs in the dictionary are needed so a
> dump of all values does not work.
>
> Also, the order in which the values are joined is important so walking
> through and joining all values does not work either.
Well, a dictionary is by definition unordered, so you will need to
tell python which elements you want, and in which order.
I would do something like this:
####
config = {}
# insert code here to set the values of config
keysToDump = ['test1', 'test2', 'test3']
output = '\\'.join(config[k] for k in keysToDump)
####
(note that, if you are using python2.3 or earlier, you will need to
write that last line as:
output = '\\'.join([config[k] for k in keysToDump])
)
HTH!
--
John.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor