Newbie needs Help
John Machin
sjmachin at lexicon.net
Thu Aug 17 01:13:56 EDT 2006
Dennis Lee Bieber wrote:
> c.execute("insert into %s (%s) values (%s)"
> % ("statecode",
> ", ".join(data.keys() ),
> ", ".join(["%s"] * len(data.keys() ) ) ),
> data.values() )
> # NOTE: only works if data.keys() and data.values() are
> # in the same order.
>
It is guaranteed, provided you don't mutate the dictionary between
times. In any case, it's a bit hard to imagine under what circumstances
there would be different traversal orders to obtain keys and values :-)
More information about the Python-list
mailing list