Home > database >  Why does python pyttsx3 ignore my 3rd input?
Why does python pyttsx3 ignore my 3rd input?

Time:12-16

I am trying to get pyttsx3 to say text, a variable, and then more text, but for some reason it ignores the 3rd input and moves on to the next line of text. Here is the code:

    elif "what is the weather" in query:
        replaced_temp = temp.replace('F', '')

        tts.say('In'   g.city, 'it is currently'   replaced_temp)
        tts.runAndWait()
        print("completed")

When I run the code it says, "In " and nothing else, it skips to the next line and prints completed.

I've tried to make seperate tts.say lines, seperating the speech into different parts and it works, there are just big pauses in between the lines of code.

CodePudding user response:

Why not try f-strings:

tts.say(f"In {g.city} it is currently {replaced_temp}")
  • Related