| 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 HTML in Python
    Python fornisce ai programmatori gli strumenti e la flessibilità necessaria per creare applicazioni che servono una vasta gamma di funzioni in molti settori diversi. Codice Python può essere eseguito come Interface (CGI ) script Common Gateway che creano pagine web al volo . Python tratta le tag HTML come tutti gli altri dati di stringa . Il semplice comando Python " stampa" in grado di produrre codice HTML che il server Web e il browser Web dell'utente trattano come qualsiasi altro codice HTML . Cose che ti serviranno
    Plain Text Editor
    accesso a Linux o Unix web server con installato Python come linguaggio CGI
    FTP ( File Transfer Protocol ) applicazione
    Show More Istruzioni
    pagina 1

    lanciare il testo testo normale applicazione editor disponibile sul vostro Linux , Windows o Mac OS X . Questi includono Blocco note su un PC o Jedit , Komodo Edit , Smultron , BBEdit o TextMate su una .
    2

    Mac Inserisci il seguente codice nell'editor di testo esattamente come mostrato di seguito . Gli spazi vuoti e indentazione hanno significato in Python . Il primo commento è necessario per caricare l'interprete Python :

    # /usr /bin /python

    print " Content-Type : text /html \\ n \\ n" !
    < P > def generate_page ( ) :

    print " \\ n" print

    " \\ n"

    print " \\ t mia Python Demo HTML < /TITLE > \\ n " <br> <p> print" < /HEAD > \\ n " <br> <p> stampa" <BODY BGCOLOR =#F7FCAE> \\ n " <br> < p > print " \\ t <H1> Ciao Mondo </h1 > \\ n" <br> <p> print " < /BODY > \\ n" <br> <p> print " < /HTML > \\ n" < br <p> generate_page > ( ) <br> <p> 3 Fare clic sul menu " File " e poi selezionare " Salva ". Assegnare un nome al " myhtml.py . " File <br> 4 <p> Lanciare l' applicazione FTP e accedere al Web server. <br> 5 <p> Carica il file " myhtml.py " per la directory principale del server Web . <br> 6 <p> modificare i permessi di " myhtml.py " per consentire lo script da eseguire tramite l'applicazione FTP . Il " chmod " maschera permesso è 775 . Per la maggior parte delle applicazioni FTP , il permesso di un file viene modificato selezionando e cliccando col tasto destro sul nome del file e quindi selezionando l' opzione per cambiare "Proprietà" o "Autorizzazioni ". Alcune applicazioni FTP consentono di inserire un attributo numero di tre cifre o " chmod ". Per questi programmi FTP , immettere " 775 " nella casella di input e premere " Invio". Altre applicazioni consentono i permessi da impostare selezionando le caselle di controllo . Per queste applicazioni , inserire un segno di spunta nelle caselle seguenti attributi : <br> <p> Proprietario : lettura , scrittura, esecuzione <br> <p> Gruppo: Lettura, Esecuzione <br> <p> Altro: Lettura, Esecuzione <br> <p> Fare clic su " OK" per impostare le autorizzazioni . <br> 7 <p> Fare clic sul pulsante "Disconnect " dell'applicazione FTP. <br> 8 <p> Avviare un browser web . Inserire l'URL appropriato per accedere allo script Python , ad esempio " http://yourdomainname.com/myhtml.py . " Sostituire " yourdomainname.com " con il nome del dominio o l'indirizzo IP del server web . <br> 9 <p> Premere il tasto "Enter" per caricare l'URL ed eseguire lo script Python . <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/94081.html' >Come utilizzare Python Math.log Con Base 10 </a></li></p></td> </tr> <tr> <td width="49%"> next : <a class='LinkNextArticle' href='/Programmazione/python-programming/94083.html' >Come creare una cartella 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/93900.html" title="Come utilizzare un doppio ciclo For su Python " target="_self">Come utilizzare un doppio ciclo For su Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93861.html" title="Come esecuzione di Python 2.7 dalla clipboard " target="_self">Come esecuzione di Python 2.7 dalla clipboard </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93896.html" title="Come risolvere l' IP in Python " target="_self">Come risolvere l' IP in Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93920.html" title="Come estrarre l'utilizzo della CPU Con Python " target="_self">Come estrarre l'utilizzo della CPU Con Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93847.html" title="Come convertire MATLAB script di Python " target="_self">Come convertire MATLAB script di Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93890.html" title="Come ottenere le funzioni di un oggetto in Python " target="_self">Come ottenere le funzioni di un oggetto in Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93926.html" title="Come eseguire bytecode Python " target="_self">Come eseguire bytecode Python </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/94098.html" title="Come verificare se un file esiste e quindi eliminarlo in Python " target="_self">Come verificare se un file esiste e quindi eliminarlo i…</a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/python-programming/93729.html" title="Come ottenere Python per ottenere un output dell'immagine " target="_self">Come ottenere Python per ottenere un output dell'immagi…</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></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/java-programming/90275.html" title="Che cosa è la mappatura delle azioni in Struts ? " target="_self">Che cosa è la mappatura delle azioni in Struts ? </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/php-mysql-programming/92759.html" title="Come cambiare la password di script PHP per MySQL " target="_self">Come cambiare la password di script PHP per MySQL </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/javascript-programming/91018.html" title="Come accedere agli attributi elemento con JavaScript " target="_self">Come accedere agli attributi elemento con JavaScript </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/computer-programming-languages/88449.html" title="Istruzioni di programmazione PLC " target="_self">Istruzioni di programmazione PLC </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/visual-basics-programming/94729.html" title="Come associare dati a una casella di testo in VB " target="_self">Come associare dati a una casella di testo in VB </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/visual-basics-programming/95532.html" title="Come rilevare i livelli audio da uscita in Visual Basic " target="_self">Come rilevare i livelli audio da uscita in Visual Basic…</a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/php-mysql-programming/92473.html" title="Come reimpostare AutoIncrement in MySQL " target="_self">Come reimpostare AutoIncrement in MySQL </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/computer-programming-languages/87400.html" title="I vantaggi di Algoritmi Rijndael " target="_self">I vantaggi di Algoritmi Rijndael </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/java-programming/89506.html" title="Come creare XMLs per una JW Player " target="_self">Come creare XMLs per una JW Player </a></td></tr><tr><td width="10" valign="top" class="">·</td><td class=""><a class="" href="/Programmazione/javascript-programming/91009.html" title="Come visualizzare le Ore e Minuti in due campi con Javascript " target="_self">Come visualizzare le Ore e Minuti in due campi con Java…</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>