python的版本问题

发布于 2021-09-29  837 次阅读


python3自带工具-python2转python3

  1. path 找到python3安装路径
  2. 打开其下\Tools\scripts\, 找到2to3.py
  3. 其中使用-w时, 有
    1. 批量写回目录下所有文件-w E:\Dir_Path\
    2. 写回单个文件-w E:\Dir_Path\File_Name.py
--help

导入six.moves模块

six是用于兼容python2与python3写法的包. The six.moves module provides those modules under a common name for both Python2 and 3 (mostly by providing the Python2 module under the name of the Python 3 module). 具体用法为:

from six.moves import urllib