!ls in Jupyter notebook (Python 3)
<p>If I use:</p>

<pre><code>!ls '/Users/martyn/Documents/rawData'
</code></pre>

<p>it gives me a list of the files in the required directory.</p>

<p>But I want to paramterize this. I tried:</p>

<pre><code>pathData = '/Users/martyn/Documents/rawData'
!ls pathData
</code></pre>

<p>But this gives the error:</p>

<pre><code>ls: pathData: No such file or directory
</code></pre>

<p>I can see the problem ... but can't see how to fix it. Any help would be greatly appreciated.</p>

<p>You probably need</p>

<pre><code>!ls {pathData}
</code></pre>

<p>or</p>

<pre><code>!ls $pathData
</code></pre>

python ipython jupyter-notebook