!ls in Jupyter notebook (Python 3)
11,725
Solution 1
You probably need
!ls {pathData}
or
!ls $pathData
Solution 2
Using only %ls
gives you the list in your current directory.
Author by
Martyn
Updated on June 20, 2022Comments
-
Martyn almost 2 years
If I use:
!ls '/Users/martyn/Documents/rawData'
it gives me a list of the files in the required directory.
But I want to paramterize this. I tried:
pathData = '/Users/martyn/Documents/rawData' !ls pathData
But this gives the error:
ls: pathData: No such file or directory
I can see the problem ... but can't see how to fix it. Any help would be greatly appreciated.