当前位置: 代码迷 >> 综合 >> 利用PowerShell把Python 2.x代码转化为Python 3.x代码
  详细解决方案

利用PowerShell把Python 2.x代码转化为Python 3.x代码

热度:14   发布时间:2024-01-16 19:25:42.0

1.Window系统下,在要转换的代码所在文件夹按住Shift键,鼠标右键选择在当前窗口打开PowerShell或命令行窗口;

2.输入 2to3 example.py 回车查看example.py中需要修改的部分;

3.输入 2to3 -w example.py 回车自动将python 2.x版本代码转化为python 3.x版本代码.

  相关解决方案