<div dir="ltr">Ciao,<br><div class="gmail_extra"><br><div class="gmail_quote">Il giorno 24 aprile 2017 17:51, Marcello <span dir="ltr"><<a href="mailto:marcello@linuxvil.it" target="_blank">marcello@linuxvil.it</a>></span> ha scritto:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ciao a tutti,<div><br></div><div>devo ordinare un dizionario in base al nome.</div><div>Ho provato, cercando sul web, OrderedDict dovrebbe essere quello che fa al caso mio.</div><div><br></div><div><div>import collections</div><div>diz = [{'add': '10', 'name': 'ccc', 'pwd': '12'}, {'add': '11', 'name': 'aaa', 'pwd': '45'}, {'add': '12', 'name': 'bbb', 'pwd': '79'}]</div><div>print (collections.OrderedDict(<wbr>sorted(diz.items(), key=lambda t: t[1])))</div></div><div><br></div><div>ma mi viene restituito un errore </div><div>AttributeError: 'list' object has no attribute 'items'<br></div><div><br></div><div>E' come se diz venisse visto come lista e non come dizionario.</div></div></blockquote><div><br>diz in effetti è una lista con dentro n-dizionari :)<br><br>-- <br></div></div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">"Unix IS user friendly. It's just selective about who its friend are"<br><br>"Nevertheless I still think it’s a bad idea to make things harder for ourselves
if we can avoid it."<br><span><br>"C is quirky, flawed, and an enormous success."<br>                                   -- Dennis Ritchie<br></span><br><span>"Shipping is a feature. A really important feature. Your product must have it."<br><br>"</span><span>There is no such a thing as a temporary change or workaround: In most cases, workarounds are tech debt."<br><br></span></div><div>"La gatta frettolosa ha fatto i gattini ciechi"<br><br></div></div></div></div></div></div></div></div></div></div>
</div></div>