Hello
I fill two dictionaries with the same number of keys, and then need to
compare the value for each key, eg.
#Pour chaque APE, comparaison societe.ape.nombre et verif.ape.nombre
import apsw
#
dic1={}
[...]
rows=list(cursor.execute(sql))
for id in rows:
dic1[id[0]] =
Gilles Ganault:
I fill two dictionaries with the same number of keys, and then need to
compare the value for each key, eg.
Probably using the DBMS capabilities you can find a better solution.
Are the keys equal? If you want to do it using dicts, you can iterate
on one dict, with iteritems, and
Gilles Ganault [EMAIL PROTECTED] writes:
Hello
I fill two dictionaries with the same number of keys, and then need to
compare the value for each key, eg.
#Pour chaque APE, comparaison societe.ape.nombre et verif.ape.nombre
import apsw
#
dic1={}
[...]
Arnaud Delobelle wrote:
Gilles Ganault [EMAIL PROTECTED] writes:
Hello
I fill two dictionaries with the same number of keys, and then need to
compare the value for each key, ...
if you know set(dic1) == set(dic2) -- that is that the same keys are
used, you could use:
Setup:
dic1 =
Scott David Daniels [EMAIL PROTECTED] writes:
Arnaud Delobelle wrote:
Gilles Ganault [EMAIL PROTECTED] writes:
Hello
I fill two dictionaries with the same number of keys, and then need to
compare the value for each key, ...
if you know set(dic1) == set(dic2) -- that is that the same keys
Arnaud Delobelle [EMAIL PROTECTED] writes:
Or to obtain a dictionary of differences:
dict((k, (v, dic2[v]) for k, v in dic1.iteritems()
if dic2[v] != v)
^
Should be k of course!
--
Arnaud
--