Skip to content
Advertisement

Can’t iterate over files within a folder in google cloud notebooks instance

I am using the notebooks instance within the AI platform in google cloud console. I have uploaded a folder inside which contains around 30 csv files.

I run the following code to iterate over the files,

JavaScript

However, for some reason, I can seem to iterate over the files. The cell just ends with no errors. How do I fix this?

Advertisement

Answer

Try replacing the ~ with the full path. Python may not do the bash expansion on that tilde:

JavaScript

This worked with this dir structure:

JavaScript

like so:

JavaScript

But didn’t work when I used the tilde.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement