local aa = {{a=11},{a=44},{a=33},{a=2} } table.sort(aa,function(a,b) return a.a>b.a end) for k, v in pairs(aa[1]) do ngx.say(k) ngx.say(v) end for k, v in pairs(aa[2]) do ngx.say(k) ngx.say(v) end for k, v in pairs(aa[3]) do ngx.say(k) ngx.say(v) end
排序: 1:整理顺序 #冒泡 lista = [5,7,11,19,99,63,3,9,1] list = [] while lista != []: number = 0 for i in lista: if number < i: number = i lista.remove(number) list.append(number) print(list) 打印结果: D:\untitled\1\venv\Scripts\python.exe D:/untitled/1/venv/main.