Sometimes, we want to play mp3 song on Python.
In this article, we’ll look at how to play mp3 song on Python.
How to play mp3 song on Python?
To play mp3 song on Python, we can use the vlc
module.
We install it by running
pip install python-vlc
Then we use it by writing
import vlc
p = vlc.MediaPlayer("file:///path/to/track.mp3")
p.play()
to create the MediaPlayer
media object with the mp3 file path to open the mp3 file.
Then we call play
to play it.
Conclusion
To play mp3 song on Python, we can use the vlc
module.