python2代码升级到python3工具

python模块lib2to3(py2转py3自动化工具)
 1 Usage: 2to3 [options] file|dir ...
 2 
 3 Options:
 4   -h, --help            show this help message and exit
 5   -d, --doctests_only   Fix up doctests only
 6   -f FIX, --fix=FIX     Each FIX specifies a transformation; default: all
 7   -j PROCESSES, --processes=PROCESSES
 8                         Run 2to3 concurrently
 9   -x NOFIX, --nofix=NOFIX
10                         Prevent a transformation from being run
11   -l, --list-fixes      List available transformations
12   -p, --print-function  Modify the grammar so that print() is a function
13   -v, --verbose         More verbose logging
14   --no-diffs            Don't show diffs of the refactoring
15   -w, --write           Write back modified files
16   -n, --nobackups       Don't write backups for modified files
17   -o OUTPUT_DIR, --output-dir=OUTPUT_DIR
18                         Put output files in this directory instead of
19                         overwriting the input files.  Requires -n.
20   -W, --write-unchanged-files
21                         Also write files even if no changes were required
22                         (useful with --output-dir); implies -w.
23   --add-suffix=ADD_SUFFIX
24                         Append this string to all output filenames. Requires
25                         -n if non-empty.  ex: --add-suffix='3' will generate
26                         .py3 files.

eg:2to3 -w test.py

转载于:https://www.cnblogs.com/buyizhiyou/p/8966583.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值