Python while循环无法按预期正常运行

时间:2019-03-17 17:49:19

标签: python while-loop

max_pool

在while循环中我犯了什么错误?

3 个答案:

答案 0 :(得分:3)

 choice = " "
 while not (choice  == 'Y' or choice ==  'N') :
      choice = input("Y for Yes or N for No")

请尝试使用此代码

答案 1 :(得分:2)

这可能会有所帮助(在语法方面,python3.x令人困惑):

{
    "id": "132",
    "timestamp": {
        "epochSecond": 1514700142,
        "nano": 213000000
    }
}

答案 2 :(得分:1)

“不”与“不等于”不同。改用它,

choice = " "
while choice!='Y' or choice!='N':
    choice = input("Y for Yes or N for No")