1 2 3 4 5 |
|
a and b should both be dict type data. How to understand this function, especially the last return? ?
为情所困2017-06-30 09:57:56
This is how it is written in Python 2. Come to Python version 3.6:
1 2 3 4 5 6 |
|
It should be more efficient. Everything else is pretty much the same.
It’s not a god-level code, nor is it difficult to understand. Just recursively merge values with the same key. What you need to know:
dict’s items method
tuples
Gathering together
The meaning of dict parameters
淡淡烟草味2017-06-30 09:57:56
1 2 3 4 5 6 7 8 |
|
阿神2017-06-30 09:57:56
Ask a question, is there something wrong with the code? If the value in the same key is a string, will the items function report an error?