title: Jupyter Notebook nbconvert without magic commands/ w/o markdown
body: <p>I have a <code>Jupyter</code> notebook and I'd like to convert it into a <code>Python</code> script using the <code>nbconvert</code> command from <em>within</em> the <code>Jupyter</code> notebook.</p>
  
  <p>I have included the following line at the end of the notebook:</p>
  
  <pre><code>!jupyter nbconvert --to script &lt;filename&gt;.ipynb
  </code></pre>
  
  <p>This creates a <code>Python</code> script. However, I'd like the resulting <code>.py</code> file to have the following properties:</p>
  
  <ol>
  <li>No input statements, such as:
  
  <blockquote>
    <p># In[27]:</p>
  </blockquote></li>
  <li>No markdown, including statements such as:
  
  <blockquote>
    <p># coding: utf-8</p>
  </blockquote></li>
  <li><p>Ignore <code>%magic</code> commands such as:</p>
  
  <ol>
  <li><code>%matplotlib inline</code></li>
  <li><code>!jupyter nbconvert --to script &lt;filename&gt;.ipynb</code>, i.e. the command within the notebook that executes the <code>Python</code> conversion</li>
  </ol>
  
  <p>Currently, the <code>%magic</code> commands get translated to the form: <code>get_ipython().magic(...)</code>, but these are not necessarily recognized in <code>Python</code>.</p></li>
  </ol>