【发布时间】:2013-12-23 11:57:44
【问题描述】:
我目前正在开发一个 python 项目,我需要它在某些时候接受用户的随机输入。
所以,如果我有,例如:
def question_one () :
answer_one = raw_input ('How many days are there in a week? ').lower()
try:
if answer_one == 'seven' or answer_one == '7' :
question_2()
一切都能创造奇迹。但是如何让 python 接受随机输入,如
def question_two () :
answer_two = raw_input ('What´s your mother´s name? ').lower()
try:
if answer_two == ***I have no idea how to code this part*** :
question_3()
在这种情况下,我需要 python 来接受任何输入并仍将用户带到下一个问题。我该怎么办?
【问题讨论】:
标签: python python-2.7 input