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

2024-04-27 21:56:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用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 ')

谢谢!


Tags: andtheyou游戏youronstepdo
3条回答

打印换行符。

print("\n")

或:

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

垂直空间的垂直选项卡。

您有几个解决方案:

更简单的方法是在行之间使用print语句,该语句单独使用,打印换行符。

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

相关问题 更多 >