说话功能在此命令中不起作用
Speak function isn't working in this command
为什么 speak() 函数在此命令中不起作用?
我想同时使用 print 和 speak of random results。
不知道为什么会说“none”。
elif 'how are you' in query:
results = print(random.choice(["I'am Fine, Thanks for asking. I hope you're fine too.\n Let me know if I can help you with something", "I'am Good, Thanks. What can I do for you?", "I am great, thanks for asking", "How may I help you?" ]))
speak(f" {results}")
问题是print
returnsNone
,分配给了results
。所以它间接地做 results = None
然后说出来。
通过分配随机选择将它们分开,然后打印它们。
results = random.choice(["I'am Fine, Thanks for asking. I hope you're fine too.\n Let me know if I can help you with something", "I'am Good, Thanks. What can I do for you?", "I am great, thanks for asking", "How may I help you?" ])
print(results)
speak(f" {results}")
为什么 speak() 函数在此命令中不起作用? 我想同时使用 print 和 speak of random results。 不知道为什么会说“none”。
elif 'how are you' in query:
results = print(random.choice(["I'am Fine, Thanks for asking. I hope you're fine too.\n Let me know if I can help you with something", "I'am Good, Thanks. What can I do for you?", "I am great, thanks for asking", "How may I help you?" ]))
speak(f" {results}")
问题是print
returnsNone
,分配给了results
。所以它间接地做 results = None
然后说出来。
通过分配随机选择将它们分开,然后打印它们。
results = random.choice(["I'am Fine, Thanks for asking. I hope you're fine too.\n Let me know if I can help you with something", "I'am Good, Thanks. What can I do for you?", "I am great, thanks for asking", "How may I help you?" ])
print(results)
speak(f" {results}")