Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to display folder contents in jupyter notebook using os

So I want to see the contents of my folder, it is a local folder and is in the same directory.

for i in os.listdir('/salesinfo'):
    print(i)

when I run this code it says it cannot find the directory
But this folder is in the same directory as the file I am writing this in, does this mean I need to change the folder location?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You forgot to add the relative marker ./:

for i in os.listdir('./salesinfo'):
    print(i)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading