hausaufgabe--python 34

00-- In python, else can be used with if; while; try 

 

01-- using "with", we can open a file without f.close():

002-- make use of exception to make the codes simplier:

 Running result:

Another way:

原文地址:https://www.cnblogs.com/Shareishappy/p/7456331.html