begin
file = open("some_file") #如果文件打开失败,用标准输入代替。
rescue
file = STDIN
end
begin
# ... process the input ...
rescue
# ... and deal with any other exceptions here.
end
begin
file = open("some_file") #如果文件打开失败,用标准输入代替。
rescue
file = STDIN
end
begin
# ... process the input ...
rescue
# ... and deal with any other exceptions here.
end