import csv
import pyttsx3
engine = pyttsx3.init()
with open('file.csv', 'r', encoding='utf8') as csv_file:
csv_reader = csv.reader(csv_file)
next(csv_reader)
for line in csv_reader:
title = line[1]
text = line[5]
print(title,text)
while True:
speech = (title,text)
engine.say(speech)
engine.runAndWait()
CODE ABOVE:
The goal of my code is to read text from a csv file. It does work however there is an issue whereby the text-to-speech playback will include saying things like "backslash n" and other non-text items. Is there a way to format my csv file to make it better to read or do I use another text-to-speech library?
Any help appreciated, this is one of my first python projects.