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