title: Deleting back-end mp3 files on voice assistant
body: <p>I am building a voice assistant using a tutorial.<a href="https://www.geeksforgeeks.org/personal-voice-assistant-in-python/" rel="nofollow noreferrer">I am attaching the link below for reference</a></p>
  <p>Now in the function def assistant_speaks(output) I have made some changes. Now whenever the assistant speaks, a back-end mp3 file is generated. The files are numbered randomly. I want to delete those mp3 files once the voice assistant stops. How to achieve that ? Here is the code -</p>
  <pre><code>num = random.randint(1,10000000000)
  def assistant_speaks(output):
      global num 
      num += 1
      print(&quot;PerSon : &quot;, output) 
      toSpeak = gTTS(text = output, lang ='en', slow = False) 
      file = str(num)+&quot;.mp3&quot; 
      toSpeak.save(file) 
      playsound.playsound(file, True)  
      os.remove(file)
  </code></pre>