Lane, Frank L wrote:
> Is there an easy way to combine dictionaries?

Hi Frank,

Yes, there is -- please see the "addDict" method that I have provided below:

Byron
---

def addDicts(a, b):
        c = {}
        for item in a:
                c[item] = a[item]
        for item in b:
                c[item] = b[item]
        return c


a = {'a':'a', 'b':'b', 'c':'c'}
b = {'1':1, '2':2, '3':3}
c = addDicts(a, b)

print c

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to