"Python 소스코드 버전 변환 2to3.py"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source lang='cli'> +<source lang='console'>))
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
4번째 줄: 4번째 줄:
;<nowiki>C:\Python34\Tools\Scripts\2to3.py</nowiki>
;<nowiki>C:\Python34\Tools\Scripts\2to3.py</nowiki>
*소스파일이 3버전에 맞게 변환되고, 원본은 "파일명.bak"으로 보존된다.
*소스파일이 3버전에 맞게 변환되고, 원본은 "파일명.bak"으로 보존된다.
<source lang='bash'>
<syntaxhighlight lang='bash'>
python C:\Python34\Tools\Scripts\2to3.py -w 소스파일명
python C:\Python34\Tools\Scripts\2to3.py -w 소스파일명
</source>
</syntaxhighlight>


==실행예시==
==실행예시==
<source lang='console'>
<syntaxhighlight lang='console'>
D:\workspace\python>type greeting.py
D:\workspace\python>type greeting.py
print 'hello'
print 'hello'
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
D:\workspace\python>python C:\Python34\Tools\Scripts\2to3.py -w greeting.py
D:\workspace\python>python C:\Python34\Tools\Scripts\2to3.py -w greeting.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: buffer
27번째 줄: 27번째 줄:
RefactoringTool: Files that were modified:
RefactoringTool: Files that were modified:
RefactoringTool: greeting.py
RefactoringTool: greeting.py
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
D:\workspace\python>type greeting.py
D:\workspace\python>type greeting.py
print('hello')
print('hello')
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
D:\workspace\python>type greeting.py.bak
D:\workspace\python>type greeting.py.bak
print 'hello'
print 'hello'
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:31 기준 최신판

1 개요[ | ]

Python 소스코드 버전 변환 2to3.py
파이썬 소스코드 버전 변경 2to3.py
C:\Python34\Tools\Scripts\2to3.py
  • 소스파일이 3버전에 맞게 변환되고, 원본은 "파일명.bak"으로 보존된다.
python C:\Python34\Tools\Scripts\2to3.py -w 소스파일명

2 실행예시[ | ]

D:\workspace\python>type greeting.py
print 'hello'
D:\workspace\python>python C:\Python34\Tools\Scripts\2to3.py -w greeting.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored greeting.py
--- greeting.py (original)
+++ greeting.py (refactored)
@@ -1 +1 @@
-print 'hello'
+print('hello')
RefactoringTool: Files that were modified:
RefactoringTool: greeting.py
D:\workspace\python>type greeting.py
print('hello')
D:\workspace\python>type greeting.py.bak
print 'hello'

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}