<pre class="lang-py prettyprint prettyprinted" style="margin-top:0px;margin-bottom:0.8em;padding:10px;border:0px;vertical-align:baseline;word-wrap:break-word;max-height:300px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline;max-height:300px;overflow:auto;white-space:normal;background-color:rgba(255,255,255,0)"><font face="Helvetica Neue, Helvetica, Arial, sans-serif" size="3"><span class="kwd" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">import</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"> unicodedata</span></font></code></pre><pre class="lang-py prettyprint prettyprinted" style="margin-top:0px;margin-bottom:0.8em;padding:10px;border:0px;vertical-align:baseline;word-wrap:break-word;max-height:300px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline;max-height:300px;overflow:auto;white-space:normal;background-color:rgba(255,255,255,0)"><font face="Helvetica Neue, Helvetica, Arial, sans-serif" size="3"><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"></span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">def</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"> remove_accents</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">input_str</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">):</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">
nkfd_form </span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">=</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"> unicodedata</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">normalize</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">(</span><span class="str" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">'NFKD'</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">,</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"> unicode</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">input_str</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">))</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">
</span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">return</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"> u</span><span class="str" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">""</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">join</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">([</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">c </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">for</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"> c </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">in</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"> nkfd_form </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">if</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"> </span><span class="kwd" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">not</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"> unicodedata</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">.</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">combining</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">(</span><span class="pln" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">c</span><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">)])</span></font></code></pre><pre class="lang-py prettyprint prettyprinted" style="margin-top:0px;margin-bottom:0.8em;padding:10px;border:0px;vertical-align:baseline;word-wrap:break-word;max-height:300px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline;max-height:300px;overflow:auto;white-space:normal;background-color:rgba(255,255,255,0)"><font face="Helvetica Neue, Helvetica, Arial, sans-serif" size="3"><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">u'gli devi passare un unicode'</span></font></code></pre><pre class="lang-py prettyprint prettyprinted" style="margin-top:0px;margin-bottom:0.8em;padding:10px;border:0px;vertical-align:baseline;word-wrap:break-word;max-height:300px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline;max-height:300px;overflow:auto;white-space:normal;background-color:rgba(255,255,255,0)"><font face="Helvetica Neue, Helvetica, Arial, sans-serif" size="3"><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline">dicci se funziona</span></font></code></pre><pre class="lang-py prettyprint prettyprinted" style="margin-top:0px;margin-bottom:0.8em;padding:10px;border:0px;vertical-align:baseline;word-wrap:break-word;max-height:300px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline;max-height:300px;overflow:auto;white-space:normal;background-color:rgba(255,255,255,0)"><a href="http://stackoverflow.com/questions/517923/what-is-the-best-way-to-remove-accents-in-a-python-unicode-string">http://stackoverflow.com/questions/517923/what-is-the-best-way-to-remove-accents-in-a-python-unicode-string</a><font face="Helvetica Neue, Helvetica, Arial, sans-serif" size="3"><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"><br></span></font></code></pre><pre class="lang-py prettyprint prettyprinted" style="margin-top:0px;margin-bottom:0.8em;padding:10px;border:0px;vertical-align:baseline;word-wrap:break-word;max-height:300px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline;max-height:300px;overflow:auto;white-space:normal;background-color:rgba(255,255,255,0)"><font face="Helvetica Neue, Helvetica, Arial, sans-serif" size="3"><span class="pun" style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;vertical-align:baseline"><br></span></font></code></pre><br><br>-- <br>Simone Federici<div>------------------------<br>Software Craftsman</div><div>XP, Agile, Scrum, Kanban</div><div>Quality, performance & security</div><div><br></div><div>Explicit is better than implicit.</div><div><br></div><br>