我刚刚进入编码并有一个查询。 我正在写一个名为Sasha的聊天机器人的脚本,但是我无法找到任何方法来解决在一个句子中不匹配所有单词的问题。假设,我想要求它检查日期的不同,而不是仅仅说'日期'。我会怎么做呢? 任何帮助表示赞赏。如何在输入python中搜索和打印项目?
Database =[
['hello sasha', 'hey there'],
['what is the date today', 'it is the 13th of October 2017'],
['name', 'my name is sasha'],
['weather', 'it is always sunny At Essex'],
]
while 1:
variable = input("> ")
for i in range(4):
if Database[i][0] == variable:
print (Database[i][1])