How to use 2to3 properly for python?

后端 未结 9 901
野趣味
野趣味 2020-12-04 17:26

I have some code in python 2.7 and I want to convert it all into python 3.3 code. I know 2to3 can be used but I am not sure exactly how to use it.

9条回答
  •  無奈伤痛
    2020-12-04 18:17

    On Windows:

    python {path_to_python}\tools\scripts\2to3.py --output-dir={output_dir} -W -n {input_dir}
    

    path_to_python = directory where Python is installed

    output_dir = directory where to output the Python3 scripts

    input_dir = directory from where to read the Python2 scripts

提交回复
热议问题