train_dir= '../input/train'
for file in os.listdir(train_dir):
print(file)
I am trying to get all the file names in a directory called "train", from a Kaggle dataset.
However, using the above code I just get a return of the folder "train", instead of all the images in the folder "train".
If I repeat the code above using:
data_dir = '../input'
for file in os.listdir(data_dir):
print(file)
Then, it works correctly, it outputs the folder "train", the file "train.csv", the file "sample_submission.csv" and the folder "test" correctly.
Hence, I am quite puzzled why it doesn't work in the first case.
Thanks a lot. I am working directly on the Kaggle kernel by the way.