##练习: 读取文件
# 输入一个数字,则读取下一行;
# 无论是否报错,都需要关闭文件
# 获取异常状态 ValueError and IOError
def read_file():
try:
f = open('d:\ip1.log','r')
try:
try:
while True:
s = f.readline()
if not s:
break
int(input('input digit to continue:'))
print(s)
finally:
f.close()
print("文件已关闭")
except ValueError:
print("value error;")
except IOError:
print("文件打开失败")
read_file()
print("programing end!")