Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2454 Lượt xem

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,
​},

​...


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

The code that has worked for me is the following:

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


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 24
2126
0
thg 4 15
2937
1
thg 3 15
6102
1
thg 7 24
1153
2
thg 5 24
2277