<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.StileMessaggioDiPostaElettronica17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=IT link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Ciao a tutti.<o:p></o:p></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span style='color:white'>Ho questa funzione che scrissi 9 anni fa con l'aiuto di uno di voi della lista, </span><span style='font-size:7.5pt;font-family:Consolas;color:#CE9178;mso-fareast-language:IT'>Federico Figus</span><span style='color:white'>, che converte un qualsiasi intero in una stringa in base 62: 10 cifre + 26 lowercase + 26 uppercase.</span><o:p></o:p></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span style='color:white'>Il problema è che se passo uno 0, non mi restituisce "0" come dovrebbe, ma una stringa "".</span><o:p></o:p></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><o:p> </o:p></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span style='color:white'>Qualcuno vede il perché?</span><o:p></o:p></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><o:p> </o:p></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span style='color:white'>def base62(n):</span><o:p></o:p></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'> <span style='color:white'>'''Converte un intero in base 10 ad una stringa in base 62.</span><o:p></o:p></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'> <span lang=EN-US style='color:white'>Author: Federico Figus </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> Modified by Gabriel Battaglia Kriyaban 9/5/2013</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> Version 2, 15/11/2022</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> '''</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> import string</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> b = string.digits+string.ascii_letters</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> n=int(n)</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> if n<0:</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> n=0</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> out = []</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> while n:</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> out.append(n%62)</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> n = int(n/62)</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-line-height-alt:10.5pt;background:#1E1E1E'><span lang=EN-US style='color:white'> return ''.join(b[l] for l in out)[::-1]</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:IT'>Gabriele Battaglia (Gabe / Gabry) - IZ4APU<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:IT'>--... ...-- -.. . .. --.. ....- .- .--. ..- - ..- . .<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:IT'>Sent from Outlook on Windows, Genus Bononiae's computer. </span><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:IT'>(Libero)</span><span style='mso-fareast-language:IT'><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>