发布时间:2019-09-06 08:53:45编辑:auto阅读(3097)
>>> import warnings
>>>
>>> warnings.filterwarnings('error')
>>>
>>> try:
... warnings.warn(Warning())
... except Warning:
... print 'Warning was raised as an exception!'
...
Warning was raised as an exception!
参考资料:
2、https://docs.python.org/2/library/warnings.html
上一篇: 使用Python写Windows Ser
下一篇: python 去除html标签的几种方法
49215
48377
39103
36208
30616
27420
26412
21248
21090
19434
47°
245°
245°
359°
574°
396°
1085°
1068°
1063°
1056°