python模块lib2to3(py2转py3自动化工具)
 Usage: 2to3 [options] file|dir ...

 Options:
-h, --help show this help message and exit
-d, --doctests_only Fix up doctests only
-f FIX, --fix=FIX Each FIX specifies a transformation; default: all
-j PROCESSES, --processes=PROCESSES
Run 2to3 concurrently
-x NOFIX, --nofix=NOFIX
Prevent a transformation from being run
-l, --list-fixes List available transformations
-p, --print-function Modify the grammar so that print() is a function
-v, --verbose More verbose logging
--no-diffs Don't show diffs of the refactoring
-w, --write Write back modified files
-n, --nobackups Don't write backups for modified files
-o OUTPUT_DIR, --output-dir=OUTPUT_DIR
Put output files in this directory instead of
overwriting the input files. Requires -n.
-W, --write-unchanged-files
Also write files even if no changes were required
(useful with --output-dir); implies -w.
--add-suffix=ADD_SUFFIX
Append this string to all output filenames. Requires
-n if non-empty. ex: --add-suffix='' will generate
.py3 files.

eg:2to3 -w test.py

python2代码升级到python3工具的更多相关文章

  1. python2.7升级到python3后,用pip进行安装时报Fatal error in launcher:Unbale to create process using`""

    解决:python2.7升级到python3后,用pip进行安装时报Fatal error in launcher:Unbale to create process using`"" ...

  2. python2代码批量转为python3代码

    由于python存在python2和python3两个主要的版本方向,经常会有将python2的代码转到python3的环境下运行的需求.尤其是跑一些神经网络的代码时有很多是在python2的环境下写 ...

  3. centos7中python2.7升级到python3.7

    一.下载源码包 # 切换到root目录 [root@localhost ~] cd /root/ # 安装wget [root@localhost ~] yum -y install wget # 使 ...

  4. centos6.5系统python2.6升级到python3.6

    1.安装必备的工具 wget:yum install wget gcc:yum install gcc zlib zlib-devel: yum install zlib zlib-devel -y ...

  5. python2.7升级到python3.6注意事项

    python3.6下载地址:https://www.python.org/downloads/source/ 1.安装依赖包:gcc   openssl-devel.zlib-devel.readli ...

  6. python2.7 升级到 python3.6

    1.命令 yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel t ...

  7. 自动发布工具版本从python2升级成python3后遇到的种种问题(涉及paramiko,Crypto,zipfile等等)

    从在公司实习到正式入职,一直还在被同事使用的是我写的一个自动发布工具.该工具的主要功能是:开发人员给出需要更新的代码包(zip格式),测试人员将该代码包部署到测服,这些代码包和JIRA数据库里的项目信 ...

  8. python 内置2to3工具将python2代码转换为python3代码

    python2与python3代码不兼容,如果需要python2代码在python3环境下运行,需要将代码进行转换,本文介绍使用python3内置工具2to3.py对代码进行转换 一:2to3.py在 ...

  9. 一键将 Python2 代码自动转化为 Python3

    问题 Python2 的代码直接在 Python3 环境运行的话会报错误: 如果大量的代码,无论是批量替换,还是逐行修改都够累的,这活儿表示不能干! 有没有办法一键转换呢? 百度了一下发现网上的方法如 ...

随机推荐

  1. Java9最受期待的5大新特性

    虽然Java9要等到明年才正式发布,但是现在网上已经有了各种各样的有关Java9新特性的文章了,今天小编也将为大家分享除了通常猜测之外的一些很值得期待的5个新特性. 1.Java + REPL = j ...

  2. Centos 6.5 HISTSIZE更改

    通过 更改 /etc/profile 中的HISTSIZE值,改完之后,执行source /etc/profile  和echo $HISTSIZE,结果还是之前的HISTSIZE值, 解决办法:执行 ...

  3. 【CZY选讲·逆序对】

    题目描述 LYK最近在研究逆序对. 这个问题是这样的. 一开始LYK有一个2^n长度的数组ai. LYK有Q次操作,每次操作都有一个参数k.表示每连续2^k长度作为一个小组.假设 n=4,k= ...

  4. JavaScript jQuery 中定义数组与操作及jquery数组操作 http://www.jb51.net/article/76601.htm

    首先给大家介绍javascript jquery中定义数组与操作的相关知识,具体内容如下所示: 1.认识数组 数组就是某类数据的集合,数据类型可以是整型.字符串.甚至是对象Javascript不支持多 ...

  5. unicode 编码在线转换工具--javascript

    http://www.cnblogs.com/mq0036/p/4007452.html

  6. MFC 屏幕截图(libjpeg bmp转jpg)

    项目中需要用到的功能. void Screenshot() { CDC *pDC; pDC = CDC::FromHandle(GetDC(GetDesktopWindow())); if(pDC = ...

  7. es6+最佳入门实践(4)

    4.函数扩展 4.1.参数默认值 默认参数就是当用户没有传值的时候函数内部默认使用的值,在es5中我们通过逻辑运算符||来实现 function Fn(a, b) { b = b || "n ...

  8. codeforces gym/100814 humming distance (二进制位数比较)

    Gym - 100814I I. Salem time limit per test 1 second memory limit per test 1024 megabytes input stand ...

  9. bzoj 1579: [Usaco2009 Feb]Revamping Trails 道路升级——分层图+dijkstra

    Description 每天,农夫John需要经过一些道路去检查牛棚N里面的牛. 农场上有M(1<=M<=50,000)条双向泥土道路,编号为1..M. 道路i连接牛棚P1_i和P2_i ...

  10. 我对 aspnetpager和repeater以及查询条件的封装

    /// <summary>         /// 绑定所有图片列表         /// </summary>         /// <param name=&qu ...