首页 > 编程语言 > 详细

python2代码升级到python3工具

时间:2018-04-28 12:21:41      阅读:252      评论:0      收藏:0      [点我收藏+]
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            Dont show diffs of the refactoring
15   -w, --write           Write back modified files
16   -n, --nobackups       Dont 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

python2代码升级到python3工具

原文:https://www.cnblogs.com/buyizhiyou/p/8966583.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!