SarkariResultess QA Bank

FileNotFoundError का सामान्य समाधान क्या है? production में इसे safely कैसे fix करें?

Other 0 Views Verified
FileNotFoundError का सामान्य समाधान क्या है? production में इसे safely कैसे fix करें?
Sarkari Result QA Bank
Editorially reviewed exam information

Answer & Explanation

4 Answers
Verified

use None as filename

use None as filename
Additional Explanation
यह विकल्प सही समाधान नहीं है।
Verified

delete the path

delete the path
Additional Explanation
यह विकल्प सही समाधान नहीं है।
Verified

open('/definitely/missing/file.txt')

open('/definitely/missing/file.txt')
Additional Explanation
यह विकल्प सही समाधान नहीं है।
Verified Correct Answer

path = Path('data.txt') if path.exists(): text = path.read_text(encoding='utf-8')

path = Path('data.txt') if path.exists(): text = path.read_text(encoding='utf-8')
Additional Explanation
सही path और existence check करें।