try to open &read msg from file ,print the error msg in casse of exception | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

try to open &read msg from file ,print the error msg in casse of exception

24th Oct 2016, 2:11 PM
ashwini salgar
ashwini salgar - avatar
1 Answer
+ 1
try: f=open("filename.txt") a=f.read () print a except: print "Error" finally: f.close ()
1st Dec 2016, 12:07 PM
Binara Sachin