파이썬 2.x.x와 파이썬 3.x.x의 변형 & 파이썬 2.x.x를 파이썬 3.x.x로 변환하는 방법

저자:작은 꿈, 2016-10-09 12:36:49, 업데이트: 2017-10-11 10:18:05

이 파일은 백 파일 (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 변수를 추가하지 않는 경우, 기본적으로 변환 과정에 대응하는 디프 콘텐츠를 현재 창으로 출력합니다.

(2) -w를 더하면 변경된 내용을 다시 원래 문서로 다시 쓰게 됩니다.

(3) bak 파일을 생성하지 않으려면 -n을 더하면 됩니다.

(4) 그 많은 출력 내용을 보고 싶지 않아, 그리고 -no-diffs, 그냥.

다른 것들은 거의 소개되지 않습니다. 관심있는 사람은 직접 계속 수 있습니다.

이 글의 사용법은길에서

이 글은 다시 편집되었습니다. 오류가 있다면 알려주세요!


더 많은

FangBeibotvs가 사용하는 Python2?

작은 꿈BotVS의 검색 서버는 Python 2.7 버전을 사용하며 BotVS 플랫폼 Python2와 Python3 모두 지원됩니다.