aaa
try:
sal=open("C:\\Users\\lachu\\Desktop\\sl.txt","r")
#print(sal.read())
#sal.seek(0)
totalsal=0
for x in sal:
totalsal=float(x)+totalsal
except ValueError:
print("not valid nuber in file")
except IOError:
print("file not found")
finally:
sal.close()
#print ("sal is",totalsal)
try:
sal=open("C:\\Users\\lachu\\Desktop\\sl.txt","r")
#print(sal.read())
#sal.seek(0)
totalsal=0
for x in sal:
totalsal=float(x)+totalsal
except ValueError:
print("not valid nuber in file")
except IOError:
print("file not found")
finally:
sal.close()
#print ("sal is",totalsal)
No comments:
Post a Comment