I have a dictionary of the type d1={"url1":0, "url2":1, ...}
. I then have two more dictionaries in the same format that contain different URLs, but the values still start from 0. Is there a way to combine the dictionaries so that the numbers automatically change and I have a dictionary that has no-repeat values (ie each URL has a unique number after addition). I tried .update()
but I don't think that it works for my purpose.
In terms of adding a clearer example, the code looks something like this:
d1 = {"url1":0, "url2":1}
d2 = {"url3":0, "url4":1}
d3 = {"url5":0, "url6":1}
I want a function that will combine these dictionaries and give me:
d4 = {"url1":0, "url2":1, "url3":2, "url4":3, "url5":4, "url6":5}
I tried d1.update(d2)
and then d1.update(d3)
, but those did not seem to work.