我剛剛進入編碼並有一個查詢。 我正在寫一個名爲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])