interpreter.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
  6. <meta property="og:title" content="2. Using the Python Interpreter" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/tutorial/interpreter.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <meta property="og:description" content="Invoking the Interpreter: The Python interpreter is usually installed as/usr/local/bin/python3.12 on those machines where it is available; putting/usr/local/bin in your Unix shell’s search path mak..." />
  11. <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
  12. <meta property="og:image:alt" content="Python documentation" />
  13. <meta name="description" content="Invoking the Interpreter: The Python interpreter is usually installed as/usr/local/bin/python3.12 on those machines where it is available; putting/usr/local/bin in your Unix shell’s search path mak..." />
  14. <meta property="og:image:width" content="200" />
  15. <meta property="og:image:height" content="200" />
  16. <meta name="theme-color" content="#3776ab" />
  17. <title>2. Using the Python Interpreter &#8212; Python 3.12.0 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?digest=b37c26da2f7529d09fe70b41c4b2133fe4931a90" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css" />
  21. <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
  22. <script src="../_static/jquery.js"></script>
  23. <script src="../_static/underscore.js"></script>
  24. <script src="../_static/doctools.js"></script>
  25. <script src="../_static/sidebar.js"></script>
  26. <link rel="search" type="application/opensearchdescription+xml"
  27. title="Search within Python 3.12.0 documentation"
  28. href="../_static/opensearch.xml"/>
  29. <link rel="author" title="About these documents" href="../about.html" />
  30. <link rel="index" title="Index" href="../genindex.html" />
  31. <link rel="search" title="Search" href="../search.html" />
  32. <link rel="copyright" title="Copyright" href="../copyright.html" />
  33. <link rel="next" title="3. An Informal Introduction to Python" href="introduction.html" />
  34. <link rel="prev" title="1. Whetting Your Appetite" href="appetite.html" />
  35. <link rel="canonical" href="https://docs.python.org/3/tutorial/interpreter.html" />
  36. <style>
  37. @media only screen {
  38. table.full-width-table {
  39. width: 100%;
  40. }
  41. }
  42. </style>
  43. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  44. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  45. <script type="text/javascript" src="../_static/copybutton.js"></script>
  46. <script type="text/javascript" src="../_static/menu.js"></script>
  47. <script type="text/javascript" src="../_static/themetoggle.js"></script>
  48. </head>
  49. <body>
  50. <div class="mobile-nav">
  51. <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
  52. aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
  53. <nav class="nav-content" role="navigation">
  54. <label for="menuToggler" class="toggler__label">
  55. <span></span>
  56. </label>
  57. <span class="nav-items-wrapper">
  58. <a href="https://www.python.org/" class="nav-logo">
  59. <img src="../_static/py.svg" alt="Logo"/>
  60. </a>
  61. <span class="version_switcher_placeholder"></span>
  62. <form role="search" class="search" action="../search.html" method="get">
  63. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
  64. <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
  65. </svg>
  66. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  67. <input type="submit" value="Go"/>
  68. </form>
  69. </span>
  70. </nav>
  71. <div class="menu-wrapper">
  72. <nav class="menu" role="navigation" aria-label="main navigation">
  73. <div class="language_switcher_placeholder"></div>
  74. <label class="theme-selector-label">
  75. Theme
  76. <select class="theme-selector" oninput="activateTheme(this.value)">
  77. <option value="auto" selected>Auto</option>
  78. <option value="light">Light</option>
  79. <option value="dark">Dark</option>
  80. </select>
  81. </label>
  82. <div>
  83. <h3><a href="../contents.html">Table of Contents</a></h3>
  84. <ul>
  85. <li><a class="reference internal" href="#">2. Using the Python Interpreter</a><ul>
  86. <li><a class="reference internal" href="#invoking-the-interpreter">2.1. Invoking the Interpreter</a><ul>
  87. <li><a class="reference internal" href="#argument-passing">2.1.1. Argument Passing</a></li>
  88. <li><a class="reference internal" href="#interactive-mode">2.1.2. Interactive Mode</a></li>
  89. </ul>
  90. </li>
  91. <li><a class="reference internal" href="#the-interpreter-and-its-environment">2.2. The Interpreter and Its Environment</a><ul>
  92. <li><a class="reference internal" href="#source-code-encoding">2.2.1. Source Code Encoding</a></li>
  93. </ul>
  94. </li>
  95. </ul>
  96. </li>
  97. </ul>
  98. </div>
  99. <div>
  100. <h4>Previous topic</h4>
  101. <p class="topless"><a href="appetite.html"
  102. title="previous chapter"><span class="section-number">1. </span>Whetting Your Appetite</a></p>
  103. </div>
  104. <div>
  105. <h4>Next topic</h4>
  106. <p class="topless"><a href="introduction.html"
  107. title="next chapter"><span class="section-number">3. </span>An Informal Introduction to Python</a></p>
  108. </div>
  109. <div role="note" aria-label="source link">
  110. <h3>This Page</h3>
  111. <ul class="this-page-menu">
  112. <li><a href="../bugs.html">Report a Bug</a></li>
  113. <li>
  114. <a href="https://github.com/python/cpython/blob/main/Doc/tutorial/interpreter.rst"
  115. rel="nofollow">Show Source
  116. </a>
  117. </li>
  118. </ul>
  119. </div>
  120. </nav>
  121. </div>
  122. </div>
  123. <div class="related" role="navigation" aria-label="related navigation">
  124. <h3>Navigation</h3>
  125. <ul>
  126. <li class="right" style="margin-right: 10px">
  127. <a href="../genindex.html" title="General Index"
  128. accesskey="I">index</a></li>
  129. <li class="right" >
  130. <a href="../py-modindex.html" title="Python Module Index"
  131. >modules</a> |</li>
  132. <li class="right" >
  133. <a href="introduction.html" title="3. An Informal Introduction to Python"
  134. accesskey="N">next</a> |</li>
  135. <li class="right" >
  136. <a href="appetite.html" title="1. Whetting Your Appetite"
  137. accesskey="P">previous</a> |</li>
  138. <li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  139. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  140. <li class="switchers">
  141. <div class="language_switcher_placeholder"></div>
  142. <div class="version_switcher_placeholder"></div>
  143. </li>
  144. <li>
  145. </li>
  146. <li id="cpython-language-and-version">
  147. <a href="../index.html">3.12.0 Documentation</a> &#187;
  148. </li>
  149. <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The Python Tutorial</a> &#187;</li>
  150. <li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Using the Python Interpreter</a></li>
  151. <li class="right">
  152. <div class="inline-search" role="search">
  153. <form class="inline-search" action="../search.html" method="get">
  154. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  155. <input type="submit" value="Go" />
  156. </form>
  157. </div>
  158. |
  159. </li>
  160. <li class="right">
  161. <label class="theme-selector-label">
  162. Theme
  163. <select class="theme-selector" oninput="activateTheme(this.value)">
  164. <option value="auto" selected>Auto</option>
  165. <option value="light">Light</option>
  166. <option value="dark">Dark</option>
  167. </select>
  168. </label> |</li>
  169. </ul>
  170. </div>
  171. <div class="document">
  172. <div class="documentwrapper">
  173. <div class="bodywrapper">
  174. <div class="body" role="main">
  175. <section id="using-the-python-interpreter">
  176. <span id="tut-using"></span><h1><span class="section-number">2. </span>Using the Python Interpreter<a class="headerlink" href="#using-the-python-interpreter" title="Permalink to this headline">¶</a></h1>
  177. <section id="invoking-the-interpreter">
  178. <span id="tut-invoking"></span><h2><span class="section-number">2.1. </span>Invoking the Interpreter<a class="headerlink" href="#invoking-the-interpreter" title="Permalink to this headline">¶</a></h2>
  179. <p>The Python interpreter is usually installed as <code class="file docutils literal notranslate"><span class="pre">/usr/local/bin/python3.12</span></code>
  180. on those machines where it is available; putting <code class="file docutils literal notranslate"><span class="pre">/usr/local/bin</span></code> in your
  181. Unix shell’s search path makes it possible to start it by typing the command:</p>
  182. <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>python3.12
  183. </pre></div>
  184. </div>
  185. <p>to the shell. <a class="footnote-reference brackets" href="#id2" id="id1">1</a> Since the choice of the directory where the interpreter lives
  186. is an installation option, other places are possible; check with your local
  187. Python guru or system administrator. (E.g., <code class="file docutils literal notranslate"><span class="pre">/usr/local/python</span></code> is a
  188. popular alternative location.)</p>
  189. <p>On Windows machines where you have installed Python from the <a class="reference internal" href="../using/windows.html#windows-store"><span class="std std-ref">Microsoft Store</span></a>, the <code class="file docutils literal notranslate"><span class="pre">python3.12</span></code> command will be available. If you have
  190. the <a class="reference internal" href="../using/windows.html#launcher"><span class="std std-ref">py.exe launcher</span></a> installed, you can use the <code class="file docutils literal notranslate"><span class="pre">py</span></code>
  191. command. See <a class="reference internal" href="../using/windows.html#setting-envvars"><span class="std std-ref">Excursus: Setting environment variables</span></a> for other ways to launch Python.</p>
  192. <p>Typing an end-of-file character (<kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Control</kbd>-<kbd class="kbd docutils literal notranslate">D</kbd></kbd> on Unix, <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Control</kbd>-<kbd class="kbd docutils literal notranslate">Z</kbd></kbd> on
  193. Windows) at the primary prompt causes the interpreter to exit with a zero exit
  194. status. If that doesn’t work, you can exit the interpreter by typing the
  195. following command: <code class="docutils literal notranslate"><span class="pre">quit()</span></code>.</p>
  196. <p>The interpreter’s line-editing features include interactive editing, history
  197. substitution and code completion on systems that support the <a class="reference external" href="https://tiswww.case.edu/php/chet/readline/rltop.html">GNU Readline</a> library.
  198. Perhaps the quickest check to see whether command line editing is supported is
  199. typing <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Control</kbd>-<kbd class="kbd docutils literal notranslate">P</kbd></kbd> to the first Python prompt you get. If it beeps, you
  200. have command line editing; see Appendix <a class="reference internal" href="interactive.html#tut-interacting"><span class="std std-ref">Interactive Input Editing and History Substitution</span></a> for an
  201. introduction to the keys. If nothing appears to happen, or if <code class="docutils literal notranslate"><span class="pre">^P</span></code> is
  202. echoed, command line editing isn’t available; you’ll only be able to use
  203. backspace to remove characters from the current line.</p>
  204. <p>The interpreter operates somewhat like the Unix shell: when called with standard
  205. input connected to a tty device, it reads and executes commands interactively;
  206. when called with a file name argument or with a file as standard input, it reads
  207. and executes a <em>script</em> from that file.</p>
  208. <p>A second way of starting the interpreter is <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-c</span> <span class="pre">command</span> <span class="pre">[arg]</span> <span class="pre">...</span></code>,
  209. which executes the statement(s) in <em>command</em>, analogous to the shell’s
  210. <a class="reference internal" href="../using/cmdline.html#cmdoption-c"><code class="xref std std-option docutils literal notranslate"><span class="pre">-c</span></code></a> option. Since Python statements often contain spaces or other
  211. characters that are special to the shell, it is usually advised to quote
  212. <em>command</em> in its entirety.</p>
  213. <p>Some Python modules are also useful as scripts. These can be invoked using
  214. <code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">module</span> <span class="pre">[arg]</span> <span class="pre">...</span></code>, which executes the source file for <em>module</em> as
  215. if you had spelled out its full name on the command line.</p>
  216. <p>When a script file is used, it is sometimes useful to be able to run the script
  217. and enter interactive mode afterwards. This can be done by passing <a class="reference internal" href="../using/cmdline.html#cmdoption-i"><code class="xref std std-option docutils literal notranslate"><span class="pre">-i</span></code></a>
  218. before the script.</p>
  219. <p>All command line options are described in <a class="reference internal" href="../using/cmdline.html#using-on-general"><span class="std std-ref">Command line and environment</span></a>.</p>
  220. <section id="argument-passing">
  221. <span id="tut-argpassing"></span><h3><span class="section-number">2.1.1. </span>Argument Passing<a class="headerlink" href="#argument-passing" title="Permalink to this headline">¶</a></h3>
  222. <p>When known to the interpreter, the script name and additional arguments
  223. thereafter are turned into a list of strings and assigned to the <code class="docutils literal notranslate"><span class="pre">argv</span></code>
  224. variable in the <code class="docutils literal notranslate"><span class="pre">sys</span></code> module. You can access this list by executing <code class="docutils literal notranslate"><span class="pre">import</span>
  225. <span class="pre">sys</span></code>. The length of the list is at least one; when no script and no arguments
  226. are given, <code class="docutils literal notranslate"><span class="pre">sys.argv[0]</span></code> is an empty string. When the script name is given as
  227. <code class="docutils literal notranslate"><span class="pre">'-'</span></code> (meaning standard input), <code class="docutils literal notranslate"><span class="pre">sys.argv[0]</span></code> is set to <code class="docutils literal notranslate"><span class="pre">'-'</span></code>. When
  228. <a class="reference internal" href="../using/cmdline.html#cmdoption-c"><code class="xref std std-option docutils literal notranslate"><span class="pre">-c</span></code></a> <em>command</em> is used, <code class="docutils literal notranslate"><span class="pre">sys.argv[0]</span></code> is set to <code class="docutils literal notranslate"><span class="pre">'-c'</span></code>. When
  229. <a class="reference internal" href="../using/cmdline.html#cmdoption-m"><code class="xref std std-option docutils literal notranslate"><span class="pre">-m</span></code></a> <em>module</em> is used, <code class="docutils literal notranslate"><span class="pre">sys.argv[0]</span></code> is set to the full name of the
  230. located module. Options found after <a class="reference internal" href="../using/cmdline.html#cmdoption-c"><code class="xref std std-option docutils literal notranslate"><span class="pre">-c</span></code></a> <em>command</em> or <a class="reference internal" href="../using/cmdline.html#cmdoption-m"><code class="xref std std-option docutils literal notranslate"><span class="pre">-m</span></code></a>
  231. <em>module</em> are not consumed by the Python interpreter’s option processing but
  232. left in <code class="docutils literal notranslate"><span class="pre">sys.argv</span></code> for the command or module to handle.</p>
  233. </section>
  234. <section id="interactive-mode">
  235. <span id="tut-interactive"></span><h3><span class="section-number">2.1.2. </span>Interactive Mode<a class="headerlink" href="#interactive-mode" title="Permalink to this headline">¶</a></h3>
  236. <p>When commands are read from a tty, the interpreter is said to be in <em>interactive
  237. mode</em>. In this mode it prompts for the next command with the <em>primary prompt</em>,
  238. usually three greater-than signs (<code class="docutils literal notranslate"><span class="pre">&gt;&gt;&gt;</span></code>); for continuation lines it prompts
  239. with the <em>secondary prompt</em>, by default three dots (<code class="docutils literal notranslate"><span class="pre">...</span></code>). The interpreter
  240. prints a welcome message stating its version number and a copyright notice
  241. before printing the first prompt:</p>
  242. <div class="highlight-shell-session notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>python3.12
  243. <span class="go">Python 3.12 (default, April 4 2022, 09:25:04)</span>
  244. <span class="go">[GCC 10.2.0] on linux</span>
  245. <span class="go">Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</span>
  246. <span class="go">&gt;&gt;&gt;</span>
  247. </pre></div>
  248. </div>
  249. <p>Continuation lines are needed when entering a multi-line construct. As an
  250. example, take a look at this <a class="reference internal" href="../reference/compound_stmts.html#if"><code class="xref std std-keyword docutils literal notranslate"><span class="pre">if</span></code></a> statement:</p>
  251. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">the_world_is_flat</span> <span class="o">=</span> <span class="kc">True</span>
  252. <span class="gp">&gt;&gt;&gt; </span><span class="k">if</span> <span class="n">the_world_is_flat</span><span class="p">:</span>
  253. <span class="gp">... </span> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Be careful not to fall off!&quot;</span><span class="p">)</span>
  254. <span class="gp">...</span>
  255. <span class="go">Be careful not to fall off!</span>
  256. </pre></div>
  257. </div>
  258. <p>For more on interactive mode, see <a class="reference internal" href="appendix.html#tut-interac"><span class="std std-ref">Interactive Mode</span></a>.</p>
  259. </section>
  260. </section>
  261. <section id="the-interpreter-and-its-environment">
  262. <span id="tut-interp"></span><h2><span class="section-number">2.2. </span>The Interpreter and Its Environment<a class="headerlink" href="#the-interpreter-and-its-environment" title="Permalink to this headline">¶</a></h2>
  263. <section id="source-code-encoding">
  264. <span id="tut-source-encoding"></span><h3><span class="section-number">2.2.1. </span>Source Code Encoding<a class="headerlink" href="#source-code-encoding" title="Permalink to this headline">¶</a></h3>
  265. <p>By default, Python source files are treated as encoded in UTF-8. In that
  266. encoding, characters of most languages in the world can be used simultaneously
  267. in string literals, identifiers and comments — although the standard library
  268. only uses ASCII characters for identifiers, a convention that any portable code
  269. should follow. To display all these characters properly, your editor must
  270. recognize that the file is UTF-8, and it must use a font that supports all the
  271. characters in the file.</p>
  272. <p>To declare an encoding other than the default one, a special comment line
  273. should be added as the <em>first</em> line of the file. The syntax is as follows:</p>
  274. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># -*- coding: encoding -*-</span>
  275. </pre></div>
  276. </div>
  277. <p>where <em>encoding</em> is one of the valid <a class="reference internal" href="../library/codecs.html#module-codecs" title="codecs: Encode and decode data and streams."><code class="xref py py-mod docutils literal notranslate"><span class="pre">codecs</span></code></a> supported by Python.</p>
  278. <p>For example, to declare that Windows-1252 encoding is to be used, the first
  279. line of your source code file should be:</p>
  280. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># -*- coding: cp1252 -*-</span>
  281. </pre></div>
  282. </div>
  283. <p>One exception to the <em>first line</em> rule is when the source code starts with a
  284. <a class="reference internal" href="appendix.html#tut-scripts"><span class="std std-ref">UNIX “shebang” line</span></a>. In this case, the encoding
  285. declaration should be added as the second line of the file. For example:</p>
  286. <div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="ch">#!/usr/bin/env python3</span>
  287. <span class="c1"># -*- coding: cp1252 -*-</span>
  288. </pre></div>
  289. </div>
  290. <p class="rubric">Footnotes</p>
  291. <dl class="footnote brackets">
  292. <dt class="label" id="id2"><span class="brackets"><a class="fn-backref" href="#id1">1</a></span></dt>
  293. <dd><p>On Unix, the Python 3.x interpreter is by default not installed with the
  294. executable named <code class="docutils literal notranslate"><span class="pre">python</span></code>, so that it does not conflict with a
  295. simultaneously installed Python 2.x executable.</p>
  296. </dd>
  297. </dl>
  298. </section>
  299. </section>
  300. </section>
  301. <div class="clearer"></div>
  302. </div>
  303. </div>
  304. </div>
  305. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  306. <div class="sphinxsidebarwrapper">
  307. <div>
  308. <h3><a href="../contents.html">Table of Contents</a></h3>
  309. <ul>
  310. <li><a class="reference internal" href="#">2. Using the Python Interpreter</a><ul>
  311. <li><a class="reference internal" href="#invoking-the-interpreter">2.1. Invoking the Interpreter</a><ul>
  312. <li><a class="reference internal" href="#argument-passing">2.1.1. Argument Passing</a></li>
  313. <li><a class="reference internal" href="#interactive-mode">2.1.2. Interactive Mode</a></li>
  314. </ul>
  315. </li>
  316. <li><a class="reference internal" href="#the-interpreter-and-its-environment">2.2. The Interpreter and Its Environment</a><ul>
  317. <li><a class="reference internal" href="#source-code-encoding">2.2.1. Source Code Encoding</a></li>
  318. </ul>
  319. </li>
  320. </ul>
  321. </li>
  322. </ul>
  323. </div>
  324. <div>
  325. <h4>Previous topic</h4>
  326. <p class="topless"><a href="appetite.html"
  327. title="previous chapter"><span class="section-number">1. </span>Whetting Your Appetite</a></p>
  328. </div>
  329. <div>
  330. <h4>Next topic</h4>
  331. <p class="topless"><a href="introduction.html"
  332. title="next chapter"><span class="section-number">3. </span>An Informal Introduction to Python</a></p>
  333. </div>
  334. <div role="note" aria-label="source link">
  335. <h3>This Page</h3>
  336. <ul class="this-page-menu">
  337. <li><a href="../bugs.html">Report a Bug</a></li>
  338. <li>
  339. <a href="https://github.com/python/cpython/blob/main/Doc/tutorial/interpreter.rst"
  340. rel="nofollow">Show Source
  341. </a>
  342. </li>
  343. </ul>
  344. </div>
  345. </div>
  346. </div>
  347. <div class="clearer"></div>
  348. </div>
  349. <div class="related" role="navigation" aria-label="related navigation">
  350. <h3>Navigation</h3>
  351. <ul>
  352. <li class="right" style="margin-right: 10px">
  353. <a href="../genindex.html" title="General Index"
  354. >index</a></li>
  355. <li class="right" >
  356. <a href="../py-modindex.html" title="Python Module Index"
  357. >modules</a> |</li>
  358. <li class="right" >
  359. <a href="introduction.html" title="3. An Informal Introduction to Python"
  360. >next</a> |</li>
  361. <li class="right" >
  362. <a href="appetite.html" title="1. Whetting Your Appetite"
  363. >previous</a> |</li>
  364. <li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  365. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  366. <li class="switchers">
  367. <div class="language_switcher_placeholder"></div>
  368. <div class="version_switcher_placeholder"></div>
  369. </li>
  370. <li>
  371. </li>
  372. <li id="cpython-language-and-version">
  373. <a href="../index.html">3.12.0 Documentation</a> &#187;
  374. </li>
  375. <li class="nav-item nav-item-1"><a href="index.html" >The Python Tutorial</a> &#187;</li>
  376. <li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Using the Python Interpreter</a></li>
  377. <li class="right">
  378. <div class="inline-search" role="search">
  379. <form class="inline-search" action="../search.html" method="get">
  380. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  381. <input type="submit" value="Go" />
  382. </form>
  383. </div>
  384. |
  385. </li>
  386. <li class="right">
  387. <label class="theme-selector-label">
  388. Theme
  389. <select class="theme-selector" oninput="activateTheme(this.value)">
  390. <option value="auto" selected>Auto</option>
  391. <option value="light">Light</option>
  392. <option value="dark">Dark</option>
  393. </select>
  394. </label> |</li>
  395. </ul>
  396. </div>
  397. <div class="footer">
  398. &copy; <a href="../copyright.html">Copyright</a> 2001-2023, Python Software Foundation.
  399. <br />
  400. This page is licensed under the Python Software Foundation License Version 2.
  401. <br />
  402. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  403. <br />
  404. See <a href="/license.html">History and License</a> for more information.<br />
  405. <br />
  406. The Python Software Foundation is a non-profit corporation.
  407. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  408. <br />
  409. <br />
  410. Last updated on Oct 02, 2023.
  411. <a href="/bugs.html">Found a bug</a>?
  412. <br />
  413. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.5.0.
  414. </div>
  415. </body>
  416. </html>