Python open() gives IOError: Errno 2 No such file or directory
问题 For some reason my code is having trouble opening a simple file: This is the code: file1 = open(\'recentlyUpdated.yaml\') And the error is: IOError: [Errno 2] No such file or directory: \'recentlyUpdated.yaml\' Naturally I checked that this is the correct name of the file. I have tried moving around the file, giving open() the full path to the file and none of it seems to work. 回答1: Make sure the file exists: use os.listdir() to see the list of files in the current working directory Make sure