정렬(3)
-
Javascript 데이터 정렬하기
ascconst replacements = { 'YYYY': '2024', 'HH24': '15', 'HH': '03', 'MI': '12', 'SS': '45' };const keys = Object.keys(replacements).sort((a, b) => a.length - b.length);descconst keys = Object.keys(replacements).sort((a, b) => b.length - a.length);
2024.12.05 -
Django group by Count함수, order by(정렬)
쿼리 select char,count(char) total from Trained_Box where status='registered' group by char order by total desc 결과 def dashboard(request) : template = 'ocr/dashboard.html' chars = Trained_Box.objects.filter(status='registered').values('char').annotate(total=Count('char')).order_by('-total') print(chars) results = { 'results' : chars } print(results) return render(request, template, results)
2021.04.03 -
2차배열 정렬
from operator import itemgetter results = [ [1, 3, 5], [2, 5, 8], [3, 1, 2], ] results.sort(key=itemgetter(1)) print(results) [ [3, 1, 2], [1, 3, 5], [2, 5, 8] ]
2020.12.27