Python FileNotFoundError: meaning and fix
FileNotFoundError: The file you tried to open does not exist.
Code that causes it
with open("memo.txt") as f:
print(f.read())
Open in the runnerThe file name or place is different. You read it before creating it. This runner cannot see files on your computer.
Create the file first with write mode ('w'), then read it. Open your own files in Python on your own computer.
How to fix it
with open("memo.txt", "w") as f:
f.write("안녕")
with open("memo.txt") as f:
print(f.read())
Open in the runnerWhy it happens
Python on this page runs inside your browser. It sees a small temporary space, not the folders on your computer.
The official docs are in English. See it in the official Python docs