1.2 KiB
1.2 KiB
2to3
파이썬 2 코드를 3으로 자동 변환. 더 많은 정보: https://manned.org/2to3.
- 파일을 변경하지않고, 변경될 내용을 출력 (모의 테스트):
2to3 {{경로/파일.py}}
- 파이썬 2 파일을 3 파일로 변경:
2to3 {{[-w|--write]}} {{경로/파일.py}}
- 특정 파이썬 2 기능을 파이썬 3로 변경 (아래는 raw_input과 print를 수정하는 예):
2to3 {{[-w|--write]}} {{경로/파일.py}} {{[-f|--fix]}} {{raw_input}} {{[-f|--fix]}} {{print}}
- 특정 기능을 제외한 모든 파이썬 2 기능을 파이썬 3로 변경:
2to3 {{[-w|--write]}} {{경로/파일.py}} {{[-x|--nofix]}} {{has_key}} {{[-x|--nofix]}} {{isinstance}}
- 파이썬 2 에서 파이썬 3 로 변환할 수 있는 목록을 출력:
2to3 {{[-l|--list-fixes]}}
- 디렉토리 안의 모든 파이썬 2 파일을 파이썬 3로 변경:
2to3 {{[-o|--output-dir]}} {{파이썬3/디렉토리/경로}} {{[-W|--write-unchanged-files]}} {{[-n|--nobackups]}} {{파이썬2/디렉토리/경로}}
- 2to3을 멀티쓰레드로 실행:
2to3 {{[-j|--processes]}} {{4}} {{[-o|--output-dir]}} {{파이썬3/디렉토리/경로}} {{[-w|--write]}} {{[-n|--nobackups]}} --no-diffs {{파이썬2/디렉토리/경로}}