python

python 2 code to python 3

migration

2to3 커맨드를 이용하면 쉽게 바꿀 수 있다.

그냥 실행하면 변경 되는 부분을 알려 준다.

$ 2to3 example.py

-w 옵션을 넣고 실행 하면 파일의 소스코드를 변경하고 기존 파일은 백업 파일로 만들어 준다.

$ 2to3 -w example.py
print "hello world"
print("hello world")

except

Last updated

Was this helpful?