【发布时间】:2020-07-03 13:14:54
【问题描述】:
这是我的代码
while True:
query = str(input())
if query in phone_book: #phone_book is a dictionary here
print(phone_book.get(query))
elif query not in phone_book:
print('Not found')
elif query == (''): #I tried using none instead of empty string but it kept running the loop
break
【问题讨论】:
-
在最后一个elif条件
elif not query中尝试如下使用。
标签: python infinite-loop