Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
2390 Представления

I have built a dictionary to collect orders according to the client, the products that have been ordered and I need to order it alphabetically by client to use it in a qweb report, nothing I have tried so far has worked for me. Any ideas?

reparto_data = {
​'Cliente 1': {
​'Pastel manzana': 12,
​'Bomba crema': 8,
​},

​'Cliente 2': {
​'Cake calabaza': 18,
​'Bombon chocolate': 8,
​},

​...


Аватар
Отменить
Автор Лучший ответ

The code that has worked for me is the following:

reparto_data2 = sorted(reparto_data.items(), key=lambda x: x[0].lower())


Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
февр. 24
2019
0
апр. 15
2904
1
мар. 15
6049
1
июл. 24
1083
2
мая 24
2158