词法定界:当一个函数内嵌套另一个函数的时候,内函数可以访问外部函数的局部变量,这种特征叫做词法定界 table.sort(names,functin (n1,n2) return grades[n1]>grades[n2] end) //内部匿名函数可以访问外部函数的n1,n2 第一类值:lua当中函数是一个值,他可以存在变量中,可以作为函数参数,可以作为返回值 function test() local i=0 return function() i++ ... end end //函数作为返
def list_test(): list1=[] def list_all_dict(a): #检测字段类型 if isinstance(a,dict): for x in range(len(a)): temp_key=list(a.keys())[x] temp_value=a[temp_key] if isinstance(temp_value,dict): list_all_dict(temp_value) else: list1.append(temp_value) list_all