Advertisements
Advertisements
प्रश्न
Write a try .... except statement that attempts to open a file for reading and catches the exception thrown when the file does not exist.
कोड लेखन
Advertisements
उत्तर
try:
file = open("data.txt", "r")
except FileNotFoundError:
print("File does not exist.")shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
