有很多时候,我们有多个字典,并且再一个列表当中,我们应该如何去将字典进行合并,其实用到了一个很简答的自建函数来进行合并,主要的逻辑就是我们获取当前字典的内容然后再合并后面的字典内容,然后通过遍历整个列表即可实现一个字典的合并。
用到的函数:
combine(second, overwrite)
Combines two dictionaries. In the case of duplicate names, the output will contain the value of the second dictionary unless overwrite is false. Null values in both dictionaries are ignored / removed.
合并两个字典。在名字重复的情况下,输出将包含第二个字典的值,除非overwrite是false。两个字典中的空值被忽略/删除。
Arguments:
this:first (Dictionary)
second (Dictionary)
overwrite (Boolean, default: true)
Returns: Dictionary
列表的遍历函数:
iterate(function, first)
Iterate an algorithm over a list. The algorithm is expected to take two objects, the current list item, and the result from the previous iteration or the v