Python 2.x.x と Python 3.x.x の変更 & Python 2.x.x を Python 3.x.x に変換する方法

作者: リン・ハーン小さな夢作成日:2016年10月9日 12:36:49 更新日:2017年10月11日 10:18:05 更新日:2017年10月11日 10:18:05 更新日:2017年10月11日 10:18:05 更新日:2017年10月11日 更新日:2017年10月11日 10:18:05 更新日:2017年10月11日 10:18:05 更新日:2017年10月18日 更新日:2017年10月18日 更新日:2017年10月18日

暗号化しました.

関連ファイル:34563264_data_from_site.py.bakが追加され,両者を比較すると,違いがわかります.

img

当前,对于2to3.py本身,也可以通过help查看到更多的用法:

D:\tmp\tmp_dev_root\python\python2_to_python3>D:\tmp\WordPress\DevRoot\Python27\Tools\Scripts\2to3.py -h
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

この記事へのトラックバック一覧です.

(1) 上記の -w 参数を加えない場合,デフォルトでは,変換に対応するdiff コンテンツを現在のウィンドウにプリントして出力するだけです.

(2) -wを追加すると,変更された内容が元のファイルに戻ります.

(3) bak ファイルを作成したくない場合は -n を追加します.

(4) 出力した内容の山を見たくないこと,加えて,no-diffs,それだけです.

この記事へのトラックバック一覧です.

2〜3の使い方路上で

誤りがある場合は,ご指摘ください.


もっと

ファングベイこの2つの言語は,

小さな夢BotVSの復習サーバーはPython 2.7版を使用しており,BotVSプラットフォームではPython2とPython3がサポートされています.