⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 101.html

📁 Python Essential Reference, Second Edition
💻 HTML
字号:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Robots" content="INDEX,NOFOLLOW">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<TITLE>Safari | Python Essential Reference, Second Edition -&gt; Launching Python Applications</TITLE>
<LINK REL="stylesheet" HREF="oreillyi/oreillyM.css">
</HEAD>
<BODY bgcolor="white" text="black" link="#990000" vlink="#990000" alink="#990000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" cellpadding=5 cellspacing=0 border=0 class="navtopbg"><tr><td><font size="1"><p class="navtitle"><a href="2.html" class="navtitle">Linux/Unix</a> &gt; <a href="0735710910.html" class="navtitle">Python Essential Reference, Second Edition</a> &gt; <a href="97.html" class="navtitle">10. Execution Environment</a> &gt; <span class="nonavtitle">Launching Python Applications</span></p></font></td><td align="right" valign="top" nowrap><font size="1"><a href="main.asp?list" class="safnavoff">See All Titles</a></font></td></tr></table>
<TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="100.html" title="Interactive Sessions"><font size="1">&lt;&nbsp;BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0735710910&snode=101" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="101.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="102.html" title="Site Configuration Files"><font size="1">CONTINUE&nbsp;&gt;</font></a></td></TR></TABLE>
<a href="5%2F28%2F2002+9%3A04%3A09+PM.html" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><font color=white size=1>155117184014003188065099048180054212144238241179195140058238111161105082191049133047181010</font><a href="read1.asp?bookname=0735710910&snode=101&now=5%2F28%2F2002+9%3A04%3A09+PM" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><br>
<FONT>
<h3>Launching Python Applications</h3>
<p>In most cases, you抣l want programs to start the interpreter automatically, rather than first having to start the interpreter manually. On UNIX, this is done using shell scripts by setting the first line of a program to something like this:</p>

<PRE>

#!/usr/local/bin/python 
# Python code from this point on... 
import string 
print "Hello world" 
... </Pre>

<p>On Windows, double-clicking a <tT CLAss="monofont">.py</tt>, <TT CLass="monofont">.pyw</tt>, <tt class="monofont">.wpy</tt>, .pyc, or <tt clasS="monofont">.pyo</tt>  file automatically launches the interpreter. Normally, programs run in a console window unless they抮e renamed with a <Tt clAss="monofont">.pyw</tt>  suffix (in which case the program runs silently). If it抯 necessary to supply options to the interpreter, Python can also be started from a <Tt clASS="monofont">.bat</Tt>  file.</p>

<p>On the Macintosh, clicking a <tT CLAss="monofont">.py</tt>  file normally launches the editor that was used to create the file. However, two special programs in the Macintosh distribution can be used to build applications. Dropping a <TT CLass="monofont">.py</tT>  file on the <TT Class="monofont">BuildApplet</tt>  program converts the program into a file that automatically launches the Python interpreter when opened. The <tt class="monofont">BuildApplication</tt>  program converts a Python program into a standalone application that can be distributed and executed on machines that don抰 have a Python installation.</p>
</font>
<P><TABLE width="100%" border=0><TR valign="top"><TD><font size=1 color="#C0C0C0"><br></font></TD><TD align=right><font size=1 color="#C0C0C0">Last updated on 3/28/2002<br>Python Essential Reference, Second Edition, &copy;&nbsp;2002 New Riders Publishing</font></TD></TR></TABLE></P>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="100.html" title="Interactive Sessions"><font size="1">&lt;&nbsp;BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0735710910&snode=101" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="101.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="102.html" title="Site Configuration Files"><font size="1">CONTINUE&nbsp;&gt;</font></a></td></TR></TABLE>
</TD></TR></TABLE>




<!--EndOfBrowse-->

</TD></TR></TABLE>
<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=#990000><tr><td><p align=center><font size=1 face="verdana,arial,helvetica" color=white>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -