<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Ehm... stai facendo un poco di confusione:<DIV>il comando import non serve ad eseguire i programmi ma a rendere disponibili delle funzioni che il tuo programma deve usare.</DIV><DIV>Se ad esempio hai bisogno di crinvere la data dovrai importare 'datetime', se devi usare delle funzioni relative al path dei file importerai 'os.path'  e così via.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Tu invece vuoi eseguire un programma. Pertanto devi lanciarlo e se il programma stesso non prevede un modo di ripetersi allora semplicemente eseguirà le sue funzioni.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>quindi dovrai fare</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>python school.py per lanciarlo e lui 'girerà' una sola volta.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>se invece vuoi scrivere un modulo puoi fare così:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>#------------------- modulo school -----------------</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>def myprint():</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    print "Firstish Grade"</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "1 + 1 =", 1 + 1</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "2+4 =", 2 + 4</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "5 - 2 =", 5 - 2</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "thirdish Grade"</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "243 - 23 =", 243 - 23</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "12 * 4 =", 12 * 4</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "12 / 3 =", 12 / 3</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "13 / 3 =", 13 / 3, " R ", 13 % 3</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "Junior High"</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "123.56 - 62.12 =", 123.56 - 62.12</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "(4 + 3) * 2 =", (4 + 3) * 2</SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;"> </SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "4 + 3 * 2 =", 4 + 3 * 2</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print "3 ** 2 =", 3 ** 2</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">    </SPAN></FONT><FONT class="Apple-style-span" face="Arial" size="1"><SPAN class="Apple-style-span" style="font-size: 9px;">print</SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>if __name__=='__main__':</DIV><DIV>    myprint()</DIV><DIV>----------------------------------------</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>in questo modo definisci un modulo che contiene una funzione.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>allora da consolle potrai lanciare il python e scrivere:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>import school</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>e poi </DIV><DIV> myprint()</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>ogni volta che digiterai  myprint() lui eseguirà la funzione.</DIV><DIV>Spero che ti si sia chiarito qualcosa....</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>G</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR><DIV><DIV>Il giorno 09/nov/06, alle ore 20:25, eugenio ha scritto:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"> <DIV><FONT face="Arial" size="2">altro problema... sembra fatto apposta!</FONT></DIV> <DIV><FONT face="Arial" size="2">richiamo il file eseguibile (si dice così???) ad esempio con il comando:</FONT></DIV> <DIV><FONT face="Arial" size="2">import hello</FONT></DIV> <DIV><FONT face="Arial" size="2">e si avvia normalmente</FONT></DIV> <DIV><FONT face="Arial" size="2">se provo per la seconda volta ad avviarlo non mi appare nulla se non di nuovo le tre &gt;&gt;&gt;</FONT></DIV> <DIV><FONT face="Arial" size="2">es.:</FONT></DIV> <DIV><FONT face="Arial" size="2">&gt;&gt;&gt; import hello</FONT></DIV> <DIV><FONT face="Arial" size="2">Hello, World!</FONT></DIV> <DIV><FONT face="Arial" size="2">&gt;&gt;&gt; import hello</FONT></DIV> <DIV><FONT face="Arial" size="2">&gt;&gt;&gt; import hello</FONT></DIV> <DIV><FONT face="Arial" size="2">&gt;&gt;&gt; import hello</FONT></DIV> <DIV><FONT face="Arial" size="2">&gt;&gt;&gt;</FONT></DIV> <DIV><FONT face="Arial" size="2">e così via</FONT></DIV> <DIV><FONT face="Arial" size="2">mi è successo soprattutto con programmi un pò più 'complessi' come questo:</FONT></DIV> <DIV><FONT face="Arial" size="2"></FONT> </DIV> <DIV><FONT face="Arial" size="2"># Questo non è esattamente vero al di fuori degli USA, ed è basato su<BR># di un vago ricordo dei miei trascorsi giovanili.<BR>print "Firstish Grade"<BR>print "1 + 1 =", 1 + 1<BR>print "2+4 =", 2 + 4<BR>print "5 - 2 =", 5 - 2<BR>print<BR>print "thirdish Grade"<BR>print "243 - 23 =", 243 - 23<BR>print "12 * 4 =", 12 * 4<BR>print "12 / 3 =", 12 / 3<BR>print "13 / 3 =", 13 / 3, " R ", 13 % 3<BR>print<BR>print "Junior High"<BR>print "123.56 - 62.12 =", 123.56 - 62.12<BR>print "(4 + 3) * 2 =", (4 + 3) * 2 <BR>print "4 + 3 * 2 =", 4 + 3 * 2<BR>print "3 ** 2 =", 3 ** 2<BR>print<BR></FONT></DIV> <DIV><FONT face="Arial" size="2">salvato come school.py</FONT></DIV> <DIV><FONT face="Arial" size="2">la prima volta viene eseguito correttamente </FONT></DIV> <DIV><FONT face="Arial" size="2">la seconda come ho spiegato poco più su...</FONT></DIV> <DIV><FONT face="Arial" size="2">cosa potrebbe provocare questo</FONT></DIV> <DIV><FONT face="Arial" size="2">riesco a risolvere questo soltanto riavviando il python (command line)!!!</FONT></DIV> <DIV><FONT face="Arial" size="2"> </FONT></DIV><FONT face="Arial" size="2"></FONT><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Python mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:Python@lists.python.it">Python@lists.python.it</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.python.it/mailman/listinfo/python">http://lists.python.it/mailman/listinfo/python</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>