Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. for x in News_headlines:
  2. st=x.string;news="";st=st.encode('utf8','ignore') #encode the string as utf8
  3. regex = re.compile('[^.,a-zA-Z\w\s]'+'') #regular expression to get the text out of the News_headlines string 'st'.
  4. news=regex.sub(' ',st)
  5. news= "espeak "+ "'"+news+"'"+" -s 100" #create the command for reading the news using espeak module.
  6. print(news)
  7. os.system(news) #execute the command of espeak.
  8. sleep(2) #wait for 3 seconds for reading the second news
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement