<div class="gmail_quote">2012/7/16 Pietro <span dir="ltr"><<a href="mailto:peter.zamb@gmail.com" target="_blank">peter.zamb@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
il problema è che persiste anche con un dizionario ordinato... come<br>
fare? perché fallisce in questo caso?<br></blockquote><div><br></div><div>Perché +NORMALIZE_WHITESPACE comprime solo dove gli spazi o i newline ci sono.</div><div><br></div><div>Invece di:</div><div><div class="im" style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
"""<br>>>> a = range(9)<br>>>> a #doctest: +NORMALIZE_WHITESPACE<br>[0, 1, 2,<br> 3, 4, 5,<br> 6, 7, 8]<br></div><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">>>> import collections</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">>>> z = collections.OrderedDict([('a', 0), ('b',1), ('c',2), ('d',3)])</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">>>> z #doctest: +NORMALIZE_WHITESPACE</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">OrderedDict([</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> ('a', 0),</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> ('b', 1),</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> ('c', 2),</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> ('d', 3)</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> ])</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">"""</span></div><div><br>
</div><div>Scrivi:</div><div><div class="im" style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">"""<br>>>> a = range(9)<br>>>> a #doctest: +NORMALIZE_WHITESPACE<br>
[0, 1, 2,<br> 3, 4, 5,<br> 6, 7, 8]<br></div><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">>>> import collections</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">>>> z = collections.OrderedDict([('a', 0), ('b',1), ('c',2), ('d',3)])</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">>>> z #doctest: +NORMALIZE_WHITESPACE</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">OrderedDict([</span><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">('a', 0),</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> ('b', 1),</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> ('c', 2),</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> ('d', 3)</span><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">])</span><br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><span style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">"""</span></div><div><br>
</div><div>E dovrebbe andarti.</div><div><br></div><div>Ciao.<br>Marco.</div></div>