Help with .txt files!

HI, I am trying to read a file in my code named numbers.txt, but when I run it to open the file, the code it says
Errno 2 no such file or directory: ‘numbers.txt’

why would that happen?
I saved the file in windows notepad.

Here is my code:

def main():
    infile = open('numbers.txt', 'r')

    file_contents =



Are you sure the path is correct for the text file? I got similar error when not specifying the full path, for example if my file was located in documents I would put ‘/users/my name/documents/numbers.txt’

Yes, thank you! I actually realized that I had saved it onto my desktop. When I moved it to the same file as the program, it worked. Thank you so much! :slight_smile: