six.moves的用法

six是用来兼容python 2 和 3的,我猜名字就是用的2和3的最小公倍数。

six.moves 是用来处理那些在2 和 3里面函数的位置有变化的,直接用six.moves就可以屏蔽掉这些变化

Python 3 reorganized the standard library and moved several functions to different modules. Six provides a consistent interface to them through the fake six.moves module. For example, to load the module for parsing HTML on Python 2 or 3, write:

from six.moves import html_parser

Similarly, to get the function to reload modules, which was moved from the builtin module to the imp module, use:

from six.moves import reload_module

 

原文地址:https://www.cnblogs.com/charlesblc/p/8027289.html