데이터 코딩랩

input().strip().split() 본문

Algorithm/이론

input().strip().split()

researcher 틴틴 2025. 4. 17. 11:44

궁금증이 생김

 

import sys
input = sys.stdin.readline

#이걸로 input 받을때 
#input().strip() 으로 개행을 없애주잖아 그런데 만약 
#input().split() 조건도 넣고싶으면 strip 을 어디에 쓰는지

 

✅ 결론

input().strip().split()
개행문자 제거 후, 공백 기준으로 나누기
→ 순서 중요: strip 먼저, split 나중!

 

✅ 정리