Advertisement
AceScottie

talk time

Aug 1st, 2018
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. import espeak
  2. from time import gmtime, strftime
  3. es = espeak.ESpeak()
  4. while True:
  5.     get_time = raw_input('press enter to hear time')
  6.     curtime=strftime("%H:%M", gmtime())
  7.     hour = int(curtime[:2])
  8.     min = int(curtime[3:])
  9.     if hour >12:
  10.         hour -= 12
  11.         denote = "pm"
  12.     else:
  13.         denote = "am"
  14.     sayTime = str(hour)+":" +str(min)+" "+denote
  15.     print(sayTime)
  16.     es.say(sayTime)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement