- <p>Nikola intends to let you show code easily via listings:</p>
- <p><a class="reference external" href="link://listing/listings/hello.py">hello.py</a> <a class="reference external" href="link://listing_source/listings/hello.py">(Source)</a></p>
- <pre class="code python"><a name="rest_code_39d324261d5b4eb2910076b264d3954a-1"></a><span class="ch">#!/usr/bin/python</span>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-2"></a>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-3"></a><span class="kn">import</span> <span class="nn">sys</span>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-4"></a>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-5"></a>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-6"></a><span class="k">def</span> <span class="nf">hello</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">'world'</span><span class="p">):</span>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-7"></a> <span class="n">greeting</span> <span class="o">=</span> <span class="s2">"hello "</span> <span class="o">+</span> <span class="n">name</span>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-8"></a> <span class="nb">print</span><span class="p">(</span><span class="n">greeting</span><span class="p">)</span>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-9"></a>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-10"></a>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-11"></a><span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">"__main__"</span><span class="p">:</span>
- <a name="rest_code_39d324261d5b4eb2910076b264d3954a-12"></a> <span class="n">hello</span><span class="p">(</span><span class="o">*</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span>
- </pre>
|