728x90

모듈 소스를 볼 때, 아래와 같은 코드를 발견할 때가 있습니다.
from __future__ import print_function
짧게 설명하면 Python2를 Python3으로 일일히 고쳐주기 싫을 때, 해당 모듈을 쓰면 사용 가능합니다.
# In python version 2
print 'hello world'
# From python version 3
print('hello world')
다른 모듈의 종류는 이렇게 있습니다.
from __future__ import absolute_import, division,
print_function,
nested_scopes,
generators,
with_statement,
unicode_literals
728x90
'Skills > Pythons' 카테고리의 다른 글
| [Python] 프로그래머스 배열 회전 시키기 (0) | 2022.12.29 |
|---|---|
| [Python] Jupyter module - %load_ext autoreload %autoreload 2 (0) | 2022.12.23 |
| [Python] None 보다는 예외를 발생시키는 방법 (2) | 2022.12.13 |
| [Python] 딕셔너리 - defaultdict의 사용 (0) | 2022.12.08 |
| [Python] dictionary 딕셔너리 - in, KeyError, get, setdefualt 메서드 (0) | 2022.12.07 |
댓글