on-internet
← Community

Splitting the contents of a text file into multiple paragraphs

Stack Overflow ·

I'm trying to create multiple mp3 files based on one existing text file. The text file is separated by paragraphs. I have figured out to use gTTS to convert the text to audio but I'm having trouble with splitting the text file. Text file: [Hello Jay Hello Tom] I want to have two different audio files. one that says "Hello Jay" and another that says "Hello Tom". I only managed to convert the text file into a single audio file that says "Hello Jay Hello Tom" at this point. from gtts import gTTS with open("1_3.txt", encoding = "utf-8") as file: file = file.read() speak = gTTS(file, lang= "en") sp

Comments

Sign in or sign up to comment and upvote.

No comments yet.