how to use pygame to play music code example

Example 1: hot to pay music in pygame

pygame.init()

pygame.mixer.music.load('Your_music_file_name_hear.mp3')
pygame.mixer.music.play()

Example 2: pygame music player

import pygame

pygame.init()
pygame.mixer.play('datei.wav')

Example 3: how to put song in pygame

#has to be in .mp3 format
#has to be in same folder
#load the music
pygame.mixer.music.load('song.mp3')
#play the music infinite
pygame.mixer.music.play(-1)
#or play it one time
pygame.mixer.music.play(0)