Subscribe Us

Header Ads

How to Convert Text File to Mp3 File Using Python | Python Projects

 Hey guys in this video i am gonna tell you how you can convert text file to mp3 file using Python...




Source code... 

first you need a text file which contain text..

#required module - pip install gtts

from gtts import gTTS

#opening a file
f = open("textfile.txt", 'r')

#passing file data
tts = gTTS(f.read())

#saving file as mp3
try:
    tts.save("hello1.mp3")
except:
    print("file not created")



Post a Comment

0 Comments