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