from warnings import filterwarnings, catch_warnings
with catch_warnings():
if sys.py3kwarning:
filterwarnings("ignore", ".*mimetools has been removed",
DeprecationWarning)
import mimetools
import SocketServer
对于这段代码,开始第一句
from warnings import filterwarnings, catch_warnings
这里import 了catch_warning,可是这里真心没看懂
with catch_warnings():
if sys.py3kwarning:
filterwarnings("ignore", ".*mimetools has been removed",
DeprecationWarning)
import mimetools
原文:http://my.oschina.net/u/1450570/blog/406397