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 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM