python – 在单行中询问多个用户输入

我正在使用
Python 3,我正在寻找一种方法让程序在一行中询问2个用户输入.

我正在寻找的输出示例:

enter first input:                      enter second input:

然而,我知道要求多个用户输入的唯一方法是:

first_input = input("enter first input: ")
second_input = input("enter second input: ")

#output
enter first input:
enter second input: 

我正在寻找的那个可能吗?如果有,有人可以教我怎么做吗?

最佳答案

choices = raw_input("Please enter two input and seperate with space")
value1, value2 = choices.split(" ")

现在,如果输入1 56或类似值,则value1将为1,value2将为56.
您可以为分割功能选择另一个分隔符.

点赞