Code for File open and read-error

Though poem.txt is uploaded, I am getting error as file not found

I think the path of the file is incorrect. Just right click on the poem.txt and it will prompt to copy path. Then paste that path in as
f = open("path", "r")
Hope this helps!


Yeah. The path seems to be incorrect. But don’t know how I landed there.
Later I closed my notebook and opened again. And then the code got executed as expected.
Thanks for your response

1 Like


If you face this problem next time then you can run magic command to execute os command on google colab to find out your current location and then trubolshot file location.

1 Like