【发布时间】:2017-07-11 08:17:42
【问题描述】:
此代码有问题,因为我不断收到语法错误。我创建了一个包含不同问候语的列表,但我无法在第 24 行回忆它。请帮助。谢谢:)
import pyttsx
import sklearn
import random
speech_engine = pyttsx.init('sapi5') # see http://pyttsx.readthedocs.org/en/latest/engine.html#pyttsx.init
speech_engine.setProperty('rate', 150)
def Hello():
words = [line.strip() for line in open('Hello.txt')]
speak(random.choice(words))
def speak(text):
speech_engine.say(text)
speech_engine.runAndWait()
intro=(Hello())
Greeting=input(speak("What is your name"))
Account=input(speak(intro + Greeting + ", Would you like to Log in or create an account"))
if Account==("Create An Account") or Account==("Create An Account") or Account==("create an account"):
Password=input(speak("What is the password going to be for your account"))
text_file = open("Password.txt", "a")
text_file.write("| "+ Greeting +" | "+ Password +" |\n")
text_file.close()
【问题讨论】:
标签: python string tkinter python-3.5 nonetype