[Tutor] Reversed dictionary returned by default

Huperetes jhuperetes at gmail.com
Fri Mar 1 20:48:08 CET 2013


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)?

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130301/910157f9/attachment.html>


More information about the Tutor mailing list