How to make something say in python

354 Views Asked by At

I want my python program to say like

a = "Hello Boss I am your program"
say(a)
#and it should say the text

thanks in advance!

1

There are 1 best solutions below

0
On BEST ANSWER

first you need to install module named PYTTSX3.

do pip/pip3 install PYTTSX3

then code is here:

import PYTTSX3 as speaker
tts = speaker.init()

def say(text):
   tts.say(text)
   tts.runAndWait()

a = "Hello Boss I am your program"
say(a)

This will read aloud 'Hello Boss I am your program' ;)