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. 【BestCoder #48】

    与之前一样,秒刷A和B,然后就永远卡在了C B也因为少看一句话被Hunt掉了 说说C的做法吧(分块大法好 给定一个序列,每次询问区间l-r,求∑(ai^bi),其中bi是指ai在区间中的出现次数,ai ...

  2. [HNOI2015][bzoj4011] 落叶枫音 [拓扑DP]

    题面 传送门 思路 首先有一个结论(应该是有比较大的利用价值的): 有向无环图的生成外向树树个数等于所有入度非0的点的入度乘积 然后这道题里面,唯一不合拍的因素就是这里有一条可能成环的边 我们可以把这 ...

  3. BZOJ1055[HAOI2008]玩具取名 【区间dp + 记忆化搜索】

    题目 某人有一套玩具,并想法给玩具命名.首先他选择WING四个字母中的任意一个字母作为玩具的基本名字.然后 他会根据自己的喜好,将名字中任意一个字母用“WING”中任意两个字母代替,使得自己的名字能够 ...

  4. Codeforces 932.C Permutation Cycle

    C. Permutation Cycle time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  5. bzoj 2159 - Crash 的 文明世界

    Description 给定一棵\(n\le 10^5\)的树, 和\(k\le 150\) 求每个点\(x\)的\[S(x) = \sum_{y=1}^n dis(x, y) ^ k\] Analy ...

  6. POJ1163 The Triangle

    Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 44997   Accepted: 27174 Description 73 ...

  7. 《Linux命令行与shell脚本编程大全 第3版》创建实用的脚本---11

    以下为阅读<Linux命令行与shell脚本编程大全 第3版>的读书笔记,为了方便记录,特地与书的内容保持同步,特意做成一节一次随笔,特记录如下:

  8. 双缓冲(Double Buffer)原理和使用【转】

    转自:http://blog.csdn.net/acs713/article/details/16359551 原文出自:http://blog.csdn.net/xiaohui_hubei/arti ...

  9. 非常好!!!Linux源代码阅读——环境准备【转】

    Linux源代码阅读——环境准备 转自:http://home.ustc.edu.cn/~boj/courses/linux_kernel/0_prepare.html 目录 Linux 系统环境准备 ...

  10. 开始gentoo之旅

    买了一台i7笔记本,dell 15游戏匣7559,老笔记本dell n4030装了gentoo. 用了两天,先用着,再慢慢学内核编译.