Algorithm/Troubleshooting
[error] 주피터 sys.stdin.readline 오류
갬미
2021. 12. 28. 02:00
주피터에서 다음 소스코드를 입력하면 아래와 같은 오류가 발생한다
import sys
input = sys.stdin.readline
n, m = map(int,input().split())
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-1-10a214261779> in <module>
2
3 input = sys.stdin.readline
----> 4 n, m = map(int,input().split())
ValueError: not enough values to unpack (expected 2, got 0)
대체 뭐가 문제냐 ~ 했는데 sys를 import하지 않으면 해결된다
n, m = map(int,input().split())
아직 jupyter 에서는 stdin 이 제대로 구성되어 있지 않기 때문에 stdin.readline() 을 실행하면 입력을 받지 못하고 항상 빈 문자열이 반환된다고 함 ..
웃겨,, 아니 안웃겨