问题描述
你好,我目前正在制作一个语音助手,我想终止它,但它没有终止,只是不断重复
elif 'you can sleep Now' in query or 'take rest' in query:
speak('ohk master I am going to sleep you can call me again anytime going to sleep in 3,2,1')
break
if __name__ == "__main__":
while True:
permission = takeCommand()
if 'wake up' in permission:
task_execute()
elif 'close' in permission or 'buy' in permission:
speak('ok sir have a good day')
exit()
解决方法
在 speak()
后添加 function addWeight($conn,$location,$weight,$dt){
//select the two variables changing
if($location == "Weight1"){
$sql ="UPDATE userweight SET Weight1=? WHERE userId = ?;";
$sql2 ="UPDATE userweight SET timee1=? WHERE userId = ?;";
}elseif($location == "Weight2"){
$sql ="UPDATE userweight SET Weight2=? WHERE userId = ?;";
$sql2 ="UPDATE userweight SET timee2=? WHERE userId = ?;";
}elseif($location == "Weight3"){
$sql ="UPDATE userweight SET Weight3=? WHERE userId = ?;";
$sql2 ="UPDATE userweight SET timee3=? WHERE userId = ?;";
}elseif($location == "Weight4"){
$sql ="UPDATE userweight SET Weight4=? WHERE userId = ?;";
$sql2 ="UPDATE userweight SET timee4=? WHERE userId = ?;";
}
.....
以中断循环。