Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Play Mp3 Files With Python Using webbrowser Package

import webbrowser

webbrowser.open("sample.mp3")

# If you don’t have mpg123 installed on your Linux system,
# you can install it using the following command:

"""
$ sudo apt install mpg123
"""

# For macOS, we use the following code snippet to play an mp3 file using
# os package in Python.


import os

os.system("afplay " + "sample.mp3")
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #Play #Files #With #Python #Using #webbrowser #Package
ADD COMMENT
Topic
Name
6+8 =