0
import pyttsx3
import time

time = time.strftime("%M minutes past %I")

engine = pyttsx3.init()
engine.setProperty('rate',200)
engine.say("Hi Tom");
engine.say("The time is" + time);
engine.runAndWait();

When running this it will say "Hi Tom, the time is 07 minutes past 10" for example and will say a 0 in front of the minutes if its between 0-9 but 10-59 its says it normally. Is there a way to remove the 0 from being said?

Tom
  • 31
  • 1
  • 4

1 Answers1

0

Could this be useful

t = time.localtime()
   ...
engine.say('The time is %d minutes past %s' % (t.tm_min,t.tm_hour))
gtosto
  • 1,381
  • 1
  • 14
  • 18