如何在新行中打印输入

时间:2019-03-20 07:30:09

标签: python python-3.x

嘿,有一种方法可以打印这样的输入:

输入:

Enter the minimum number of feet (not less than 0):
5
Enter the maximum number of feet (not more than 99):
10

这怎么办?

2 个答案:

答案 0 :(得分:0)

只需使用\n(Python换行符)将新行添加到输入提示符,如下所示:

minFeet = input("Enter the minimum number of feet (not less than 0): \n")
maxFeet = input("Enter the maximum number of feet (not more than 99): \n")

答案 1 :(得分:-1)

您可以这样做:

print("Enter the minimum number of feet (not less than 0):")
minN = input()
print("Enter the maximum number of feet (not more than 99):")
maxN = input()