//调用方法: var targetObject = [{name:"11",age:11}]; var sourceObject = [{name:"22",age:22}]; var result = $.extend(true,targetObject,sourceObject); //手写拼接: var str1=[{name:"11",age:11}]; var str2=[{name:"22",age:22}];
两个列表合并为一个字典函数list_dic(list1,list2)可以直接复制拿走 传入的参数为两个列表,list1准备作为key,list2准备作为value,key和value位置一一对应. def list_dic(list1,list2): ''' two lists merge a dict,a list as key,other list as value :param list1:key :param list2:value :return:dict ''' dic = dict