Python输入只接受一个argumen

2024-05-19 01:18:12 发布

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

我正在用python3.3.4编写一个文本游戏,有一次我要一个名字。是否有一种方法可以只接受一个名称(输入的一个参数)以及如果用户输入多个参数。 这是我目前所拥有的。在

name =input('Piggy: What is your name?\n').title()
time.sleep(1)
print('Hello, {}. Piggy is what they call me.'.format(name))
time.sleep(1)
print('{}: Nice to meet you'.format(name))
time.sleep(1)
print('** Objective Two Completed **')

我想我需要使用while,then if和elif之类的东西。 非常感谢帮助


Tags: 方法用户name文本名称format游戏input

热门问题