相关疑难解决方法(0)

如何在Windows中使用2to3工具?

我尝试通过运行命令使用2to3工具修改sintax

python C:\Python32\Tools\scripts\2to3.py neo4j.py
Run Code Online (Sandbox Code Playgroud)

得到了输出

在此输入图像描述

打开neo4j.py时,我注意到没有任何改变.下面是应该进行更改(符合输出)的代码块:

try:
    import json
except ImportError:
    import simplejson as json
try:
    from urllib.parse import quote
except ImportError:
    from urllib import quote
try:
    from . import rest, batch, cypher
except ImportError:
    import rest, batch, cypher
except ValueError:
    import rest, batch, cypher

import logging
logger = logging.getLogger(__name__)
Run Code Online (Sandbox Code Playgroud)

有没有人知道如何正确使用2to3工具,以便将代码移植/更改为v3.2?

python python-2to3

24
推荐指数
1
解决办法
3万
查看次数

标签 统计

python ×1

python-2to3 ×1