gpt4 book ai didi

Python 2to3 - 不要删除 unicode 前缀

转载 作者:行者123 更新时间:2023-12-04 04:11:40 25 4
gpt4 key购买 nike

我正在将遗留代码库转换为 python3,并进行一些 2to3 的试运行。 2to3 从 unicode 文字中删除了 u'' 前缀,在差异中产生了很多噪音。有没有办法禁用它(因为 u'my string' 是有效的 py3 语法)?

最佳答案

来自帮助:

2to3 --help
...
-x NOFIX, --nofix=NOFIX
Prevent a transformation from being run
-l, --list-fixes List available transformations
...

使用 --list-fixes,我们发现要忽略的转换 unicode

结果:2to3 --nofix=unicode

关于Python 2to3 - 不要删除 unicode 前缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61614145/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com