0

I'm learning "Google colab" and got some problem with data reading. I've written a python script for filling folders names into arrays, but it doesn't fill at even one.

TEST_PATH = "/content/gdrive/'My Drive'/test/"
test_ids= []
try:
    test_ids = next(os.walk(TEST_PATH))[1]
except StopIteration:
    pass

list "test_ids" still empty, but there are some folders with files in TEST_PATH: here you can check it

Jonas
  • 121,568
  • 97
  • 310
  • 388
deethereal
  • 53
  • 1
  • 12

1 Answers1

0

Change your path like this: TEST_PATH = "/content/gdrive/My Drive/test/"

And to list files, I think it should be this: next(os.walk(TEST_PATH))[2].

next(os.walk(TEST_PATH))[1] will list the folders.

You can see more details in this answer: https://stackoverflow.com/a/10989155/11524628

Hoa Nguyen
  • 470
  • 6
  • 15