异常处理语法
抛出异常:
try:
	  print("handel")
	  #raise  #抛出异常
except Exception:
	  print('error!')
else:
	  print("no error just exec!!")
finally:
	  print("aways exec!")
print("一般用来关闭文件,sock等")
print("---------------")
断言:抛出布尔型错误。
try:
	  assert 1 == 0
except AssertionError:
	  print("not equal")
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号