Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
2398 Tampilan

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

​...


Avatar
Buang
Penulis Jawaban Terbai

The code that has worked for me is the following:

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


Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Feb 24
2034
0
Apr 15
2911
1
Mar 15
6059
1
Jul 24
1086
2
Mei 24
2167