2
이것은 시작적인 질문입니다. 나는 텍스트 게임을 쓰고 있는데 문제가있다.Python 2.7.13 multiline print
코드 :
def river():
print "You are traveling through deciduous forest."
print "There is nothing going on, except a few squirrels and a hedge."
print "Squirrels are fighting over nuts and a hedge is getting fat eating an apple."
print "Then you see a wide, deep river. The stream is very strong."
print "What are you going to do next?"
print "1. Try to swim the river."
print "2. Watch the squirrels and hedge."
print "3. Turn back."
while True:
choice = raw_input("> ")
if choice == "1" or choice == "swim":
print """You are doing well when in the middle of a river
something begins to bite you near legs. The bitting gets stronger
and you soon realize that piranhas are tearing chunks of your meat
off. Soon there is nothing left of you that the bones. The piranhas
seems satisfied, since they got a free meal."""
dead()
if choice == "2" or choice == "watch":
print "You keep watching animals and are becoming more and more thirsty and hungry."
if choice == "3" or choice == "turn back" or choice == "turn":
start_rewind()
start()
나는이 인쇄 문을 좋아하지 않는다. 선택 1에서와 같이 여러 줄 인쇄를 사용하면 들여 쓰기가 좋지 않습니다. 그것은 def river()와 같은 줄에 있습니다. 이것은 정상적인 스타일인가 나쁜 스타일입니까? 내가 선택한 텍스트를 들여 쓰면 선택 1과 같은 행에 있습니다. 그러면 명령 프롬프트에서 스크립트를 시작할 때 모양이 좋지 않습니다. 내가 어떻게 해결할 수 있니?
감사
왜'print' 문 안에'\ n'을 쓰지 않으시겠습니까? –