Handling a Missing File
try:
with open("does_not_exist.txt", "r") as f:
f.read()
except FileNotFoundError:
print("That file doesn't exist - check the filename and path.")
That file doesn't exist - check the filename and path.
try:
with open("does_not_exist.txt", "r") as f:
f.read()
except FileNotFoundError:
print("That file doesn't exist - check the filename and path.")
That file doesn't exist - check the filename and path.