| Home  | Casa  | Hardware  | Networking  | Programmazione  | Software  | Domanda  | Sistemi  |   
Programmazione  
  • C /C + + Programming

  • Computer Programming Languages

  • Delphi Programming

  • Java Programming

  • Programmazione Javascript

  • PHP /MySQL Programmazione

  • Perl Programming

  • Python Programming

  • rubino Programmazione

  • Nozioni di base di Visual Programming
  •  
    Conoscenza Informatica >> Programmazione >> Python Programming >> Content
    Come creare schermi o moduli con Python
    La pagina Web che si sta visualizzando è stato adattato , assemblato e generato specialmente per voi in base alle informazioni immesse in un modulo web . Quando hai fatto clic sul pulsante "invia" o "invia" , è stato eseguito un programma che verifica i dati , eseguite le operazioni necessarie sui dati , poi ha inviato una risposta a te. Il linguaggio di programmazione Python include un Common Gateway Interface o libreria CGI per l'elaborazione della modulistica . Se il server Web è installato e configurato Python come linguaggio CGI , è possibile scrivere script per creare pagine Web con le forme di input , elaborare i dati e generare risposte personalizzate . Cose che ti serviranno
    editor di testo come Blocco note
    FTP ( File Transfer Protocol ) applicazione
    Show More Istruzioni
    1

    Lanciare il testo semplice editor di blocco note facendo clic sul pulsante "Start" , poi su " Tutti i programmi ", " Accessori " e " Blocco Note ".
    2

    Inserisci il seguente codice nell'editor di testo digitandolo o selezionando il codice con il mouse , premendo il tasto " Ctrl" e " C ", poi incollarlo nell'editor con un " Ctrl " /comando " V " . Sostituire " [ trattino ] " con un rientro di cinque spazi :

    # /usr /bin /python

    print " Content-Type : text /html \\ n \\ n" !

    # /usr /bin /python

    print " Content-Type : text /html \\ n \\ n" !

    def generate_page ( ):

    [ trattino ] print " \\ n"

    [ trattino ] print " \\ n"

    [ trattino ] print " \\ t mio Python Demo HTML < /TITLE > \\ n " <br> <p> [ trattino ] print" < /HEAD > \\ n " <br> <p> [ trattino ] print" <BODY BGCOLOR =#F7FCAE> \\ n " <br> < p > [ trattino ] print " \\ t <H1> Modulo Python </h1 > \\ n" <br> <p> [ trattino ] print ' <form action="checktest.py" method="post" >' <br> <p> [ trattino ] print ' nome : <input type="text" name="firstname"> ' <br> <p> [ trattino ] print ' Cognome : < input type = " "name = " text cognome " > ' <br> <p> [ trattino ] print' <origine type="radio" name="sex" value="male" > Maschio < input type = " radio " nome = valore " sesso" = "femmina " > donne ' <br> <p> [ trattino ] print' Indirizzo e-mail: <input type="text" name="email"> ' <br> <p> [ indent] print ' <input type="submit" value="Submit"> < /form >' <br> <p> [ trattino ] print " < /BODY > \\ n" <br> < p > [ trattino ] print " < /HTML > \\ n" <br> <p> generate_page ( ) <br> <p> 3 Fare clic sul menu File . Selezionare l'opzione "Salva" . Salvare con il nome di file " myform.py . " <br> 4 <p> Fare clic sul menu File , quindi fare clic su "Nuovo ". Inserisci il seguente codice nell'editor di testo digitandolo o selezionando il codice con il mouse , premendo il tasto " Ctrl" e " C ", poi incollarlo nell'editor con un " Ctrl " /comando " V " . Sostituire " [ trattino ] " con un rientro di cinque spazi : <br> <p> # /usr /bin /python <br> <p> import cgi <br> <p> def checkForm ( ) : <br> < p > [ trattino ] print " Content-type : text /html \\ n" <br> <p> [ trattino ] form = cgi.FieldStorage ( ) per <p> [ trattino ] se form.has_key ( " cognome " ) e la forma [ " cognome " ] value = " . " : <br> <p> [ indent] [ indent] print " <h1> Nome: " , modulo " . valore , [ " Nome] " < /h1 > " <br> <p> [ trattino ] altro : <br> <p> [ indent] [ indent] print " Errore <h1> : nome non è entrata < /h1 > " <br> <p> [ indent] se form.has_key ( " cognome " ) e la forma valore [ " cognome " ] = " . " : <br> <p> [ indent] [ indent] print " <h1> Cognome: " , forma . [ " cognome " ] valore , " < /h1 > " <br> <p> [ trattino ] altro : <br> <p> [ indent] [ indent] print " <h1> Errore: No Cognome < /h1 > " <br> <p> [ trattino ] se form.has_key ( " sesso " ) e la forma [ " sesso " ] " value = . ! " : <br> <p> [ indent] [ indent] print " <h1> sesso : " , forma [ " sesso " ] . valore", < /h1 > " <br> <p> [ trattino ] altro : <br> <p> [ indent] [ indent] print " < ; h1> errore: " . ! value = Niente sesso entrato < /h1 > " <br> <p> [ trattino ] se form.has_key ( "email" ) e la forma [ " email] " " : <br> < p > [ indent] [ indent] print " <h1> email:" . , forma valore [ " email " ] , " < /h1 > " <br> <p> [ trattino ] altro : <br> <p> [ indent] [ indent] print "Errore <h1> : No email inserita < /h1 > " <br> <p> checkForm ( ) economici <p> 5 Fare clic sul menu File . Selezionare l'opzione "Salva" . Salvarlo con il nome del file " test.py. " <br> 6 <p> Lanciare l' applicazione FTP e accedere al Web server. Caricare i file " myform.py " e " test.py " nella directory principale del server web . <br> 7 <p> Utilizzare l'applicazione FTP per cambiare il permesso di " myform.py " e "test . py " per consentire gli script da eseguire . Se la tua applicazione FTP richiede di impostare autorizzazioni inserendo i numeri di chmod , immettere " 775 ", come la maschera . <br> 8 <p> Fare clic sul pulsante "Disconnetti " dell'applicazione FTP. <br> < Br > 9 <p> Avviare un browser Web , quindi immettere l'URL appropriato per accedere allo script Python : <br> <p> http://yourdomainname.com/myform.py <br> <p> Sostituire " yourdomainname.com " con il nome di dominio o l'indirizzo IP del server web . <br> 10 <p> Premere il tasto "Enter" per caricare l'URL ed eseguire lo script Python " myform.py " . Compila il modulo . Premere il tasto "Invia" . Dopo aver eseguito lo script , si dovrebbe vedere i dati immessi o un messaggio di errore . <br> <br> <div class=ad2><script language='javascript' src='/ad/201310/4.js'></script></div> </div> </td> </tr> </table> <table width="95%" height="1" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#DEE7EE"> <tr> <td></td> </tr> </table> <table width="100%" height="7" border="0" cellpadding="0" cellspacing="0"> <tr> <td></td> </tr> </table> <table width="91%" height="52" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="51%"><p>Previous : <a class='LinkPrevArticle' href='/Programmazione/python-programming/93814.html' >Funzioni Python Introspezione </a></li></p></td> </tr> <tr> <td width="49%"> next : <a class='LinkNextArticle' href='/Programmazione/python-programming/93816.html' >Che cosa è IndexError in Python ? </a></li></td> </tr> </table></td> </tr> </table> <table width="100%" height="7" border="0" cellpadding="0" cellspacing="0"> <tr> <td></td> </tr> </table> <table width="770" height="246" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="375" height="246" valign="top"><table width="380" border="0" cellpadding="0" cellspacing="0" class="bian"> <tr> <td height="244" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="img_dm/danmai_r4_c04 -.jpg" bgcolor="#DBE3EE"> <tr> <td width="4%" height="29"> </td> <td width="96%" class="lan_lm"> Articoli Correlati </td> </tr> </table> <table width="95%" height="209" border="0" align="center" cellpadding="0" cellspacing="4"> <tr> <td height="201"><table width="100%" cellpadding="0" cellspacing="0"><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93972.html" title="Come verificare in Python se un oggetto è in una classe " target="_self">Come verificare in Python se un oggetto è in una class…</a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/94140.html" title="Come leggere una pagina web utilizzando Python " target="_self">Come leggere una pagina web utilizzando Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93785.html" title="Come scrivere uno script Python che può leggere l'utilizzo della CPU su Windows " target="_self">Come scrivere uno script Python che può leggere l'util…</a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93471.html" title="Come Entra per Zangle Usare Python " target="_self">Come Entra per Zangle Usare Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93673.html" title="Come creare una nuova cartella di codice in Python " target="_self">Come creare una nuova cartella di codice in Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93465.html" title="Come fare un gioco in Python Shell " target="_self">Come fare un gioco in Python Shell </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93929.html" title="Come fare un galleggiante in Python " target="_self">Come fare un galleggiante in Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/94048.html" title="La differenza in Python e Django " target="_self">La differenza in Python e Django </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93753.html" title="Che cos'è un oggetto SQL " target="_self">Che cos'è un oggetto SQL </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/94033.html" title="Come si piazza in Python " target="_self">Come si piazza in Python </a></td></tr><tr></tr></table></td> </tr> </table></td> </tr> </table></td> <td width="20" valign="top"></td> <td width="375" valign="top"><table width="380" border="0" cellpadding="0" cellspacing="0" class="bian"> <tr> <td height="244" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="img_dm/danmai_r4_c04 -.jpg" bgcolor="#DBE3EE"> <tr> <td width="4%" height="29"> </td> <td width="96%" class="lan_lm">Articoli in evidenza </td> </tr> </table> <table width="95%" height="207" border="0" align="center" cellpadding="0" cellspacing="4"> <tr> <td height="199"><table width="100%" cellpadding="0" cellspacing="0"><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/cc-programming/85493.html" title="Come Ignora righe di commento in C + + " target="_self">Come Ignora righe di commento in C + + </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/java-programming/89882.html" title="Come generare un metodo in NetBeans " target="_self">Come generare un metodo in NetBeans </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/computer-programming-languages/87864.html" title="Come calcolare Big Endian Valore Integer " target="_self">Come calcolare Big Endian Valore Integer </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/javascript-programming/90931.html" title="Come incorporare video in un pop-up con Javascript " target="_self">Come incorporare video in un pop-up con Javascript </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/visual-basics-programming/96566.html" title="Come creare una casella di testo in Visual Basic " target="_self">Come creare una casella di testo in Visual Basic </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/java-programming/90554.html" title="Come creare un file WAR Con Eclipse " target="_self">Come creare un file WAR Con Eclipse </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/94083.html" title="Come creare una cartella in Python " target="_self">Come creare una cartella in Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/php-mysql-programming/93139.html" title="Come usare numeri da tipi di dati MySQL più comuni " target="_self">Come usare numeri da tipi di dati MySQL più comuni </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/94019.html" title="Come ottenere la lunghezza di un file in Python " target="_self">Come ottenere la lunghezza di un file in Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/php-mysql-programming/92160.html" title="Ritardo Funzioni in PHP " target="_self">Ritardo Funzioni in PHP </a></td></tr><tr></tr></table></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> </table> <table width="980" height="8" border="0" cellpadding="0" cellspacing="0"> <tr> <td></td> </tr> </table> <table border=0 cellSpacing=0 cellPadding=0 width=980 bgColor=#36506e height=90> <tr> <td class=bs height=90 align=middle>Copyright © Conoscenza Informatica http://it.wingwit.com <script language='javascript' src='/ad/201310/1.js'></script></td> </tr> </table> </div> </body> </html>