如何在 Python 脚本中的段落之间留出空格?

问题描述 投票:0回答:4

我正在用 Python 制作一个游戏(仅限文本),但是当人们玩它时会感到困惑,因为段落之间没有空格,所以它看起来像这样:

'You step outside and feel the wind on your face.'
'Which direction do you turn?'

但我希望它看起来像这样:

'You step outside and feel the breeze on your face'

'What do you do next'?

这是我的代码:

print 'You step outside and feel the cool breeze on your face.'
what = raw_input ('What do you do next ')

谢谢!

python paragraph
4个回答
9
投票

打印换行符。

print("\n")

或者:

print("An angry-looking dwarf throws an axe at you.\nYou die.\n")

3
投票

您有一些解决方案:

更简单的方法是在行之间使用

print
语句,单独使用该语句会打印换行符。

或者,您可以使用

'\n'
字符结束要打印的字符串,这将导致换行,或者您可以使用相同的字符开始输入。


1
投票
print('\v')

垂直选项卡用于垂直空间。


0
投票

我可以给你三个解决方案。

第一个解决方案

  print(f"""You step outside and feel the breeze on your face


  What do you do next?""")

第二种解决方案

print("You step outside and feel the breeze on your face. \n\nWhat do you do next?")

第三种解决方案

print("You step outside and feel the breeze on your face")
print("\n")
print("What do you do next?")

© www.soinside.com 2019 - 2024. All rights reserved.