여러줄의 문자열 한 번에 입력 받기
어래 코드가 모바일 앱 Pythonista에서는 잘 돌아가는데 IDLE에서는 안 되네요 뭐가 문제인지 알 수 있을까요??
——
print("영어 문장을 입력하세요 (문장은 $로 구분해주세요): ")
import sys
eng = sys.stdin.read()
eng = eng.split(sep="$")
print("")
print("")
print("")
print("한글 문장을 입력하세요 (문장은 $로 구분해주세요): ")
kor = sys.stdin.read()
kor = kor.split(sep="$")
temp = -1
neweng =[]
newkor = []
for x in eng:
neweng.append(x.replace("\n", ""))
for x in kor:
newkor.append(x.replace("\n", ""))
while True :
temp += 1
if temp == len(eng) :
break
answer = ""
a = neweng[temp].lstrip()
a = neweng[temp].rstrip()
answer += a + "\n"
b = newkor[temp].lstrip()
b = newkor[temp].rstrip()
answer += b
print("*****")
print(answer)
——————
(예문) 한글 칸에도 이거 넣으시면 됩니다
I am a resident of Cansinghill Apartments, located right next to the newly opened
Vuenna Dog Park.$ As I live with three dogs, I am very happy to let my dogs run
around and safely play with other dogs from the neighborhood.$ However, the noise of
barking and yelling from the park at night is so loud and disturbing that I cannot relax
in my apartment.$ Many of my apartment neighbors also seriously complain about this
noise.$ I want immediate action to solve this urgent problem. $Since you are the manager
of Vuenna Dog Park, I ask you to take measures to prevent the noise at night. $I hope to
hear from you soon.
hyunjinjang0228 님 227
M 2022년 5월 5일 12:54 오전