On Fri, Mar 1, 2013 at 2:48 PM, Huperetes <[email protected]> wrote:
> I am getting the following for my installation.
>
> Why is this happening, and how do I get it to work properly (returning
> element 0 - n, versus n - 0)?
>
This is happening because dictionaries are not ordered. The fact that it
happens to look like it is reverse order isn't guaranteed either. You use
the key to access the value. To learn more about this google 'why python
dicts are unordered'
>
> Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> params = {"server":"mpilgrim", "database":"master", "uid":"sa",
> "pwd":"secret"}
> >>> ["%s=%s" % (k, v) for k, v in params.items()]
>
> ['pwd=secret', 'database=master', 'uid=sa', 'server=mpilgrim']
>
> >>> ";".join(["%s=%s" % (k, v) for k, v in params.items()])
>
> 'pwd=secret;database=master;uid=sa;server=mpilgrim'
>
> >>>
>
> Thank you.
>
> _______________________________________________
> Tutor maillist - [email protected]
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
--
Joel Goldstick
http://joelgoldstick.com
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor