Python 임의의 문자열을 입력받기

TToII·2021년 12월 19일
post-thumbnail

몇줄인지 정해지지 않은 임의의 길이의 문자열을 받는 2가지 방법

sys read를 이용하는 방법

import sys
line = sys.stdin.read()

try except 이용하는 방법

line = ''
while True:
	try:
    	line = input()
   	except EOFError:
    	break
profile
Hello World!

0개의 댓글