Reading files with Python

Hi everyone. I’m fairly new to Python and I’m following this course my workplace provides. It shows the following code to read a file:

a = open(“demo.txt”, “r”)

Now, I’ve created a demo.txt doc in the same location as the py file but still comes back with the following:


Can anyone help? I am literally following this step by step and still no cigar :confused:


Hi @jubedmiah:

Please make sure you place to file to be read and the python file in the same base directory. for example:

|------ demo.txt