Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are running the python interpreter in <a href="http://docs.python.org/2/tutorial/interpreter.html#interactive-mode" rel="nofollow">interactive mode</a>, which <em>echos</em> values back at you. Expressions are evaluated and if they return something other than <code>None</code>, the interpreter does the equivalent of:</p> <pre><code>print(repr(result)) </code></pre> <p>That is the <code>'n'</code> you see printed.</p> <p><code>print()</code> on the other hand, writes directly to your terminal output, after converting the value to a string (the result of the <code>str()</code> function, but for a string value, there is no difference as it already <em>is</em> a string object).</p> <p>This is different from running the Python code in a script; there there is no prompt, and if you put just <code>'n'</code> on one line, the Python interpreter would just ignore that line as it doesn't alter any state. <code>print('n')</code> on the other hand still would write the string to your console or terminal.</p> <p>The interactive mode is there to help you figure out what python expressions <em>do</em>, and by using <code>repr()</code> you can distinguish between different types of objects. Try print <code>1</code> and <code>"1"</code>, so an integer number, and a string with the digit <code>1</code> in it:</p> <pre><code>&gt;&gt;&gt; print(1) 1 &gt;&gt;&gt; print("1") 1 </code></pre> <p>You cannot tell the difference between these two. But their <em>representation</em> <strong>does</strong> differ:</p> <pre><code>&gt;&gt;&gt; 1 1 &gt;&gt;&gt; "1" '1' </code></pre> <p>Representations for most Python standard types will use a notation that can be reused in your Python code, as-is.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload