2
これは初心者の質問です。私はテキストゲームを書いていて、いくつか問題があります。Python 2.7.13複数行印刷
コード:
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()
私はこれらのprint文を好きではありません。選択肢1のように複数行の印刷を使用すると、インデントがうまく見えません。それはdef river()と同じ列にあります。これは普通か悪いか?選択肢Iの下にテキストをインデントすると、選択肢1と同じ行にあります。コマンドプロンプトでスクリプトを開始すると、うまく見えません。どうすればそれを解決できますか?
おかげ
'print'文の中で' \ n'を使わないのはなぜですか? –