python2.x代码自动转换成python3.x

来源:互联网 发布:大学生消费水平的数据 编辑:程序博客网 时间:2024/05/20 08:01
import os
#py2file_path 需要转换的文件路径

#2to3.py python3.x自带的将2.x转换成3.x的程序

py2file_path=r'D:\File\python\2to3\0818_2.py'

pycode2to3=r"python D:\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\Tools\Scripts\2to3.py -w "+py2file_path
print(os.popen(pycode2to3,'r').read())
1 0
原创粉丝点击