import time
import pygame
filePath = r’C:\Users\HP_SSE\Desktop\Kalimba.mp3’ #路径
pygame.mixer.init() #初始化
track = pygame.mixer.music.load(filePath) #加载音乐
pygame.mixer.music.play() #播放
time.sleep(10) #播放10秒
pygame.mixer.music.stop()
import time
import pygame
filePath = r’C:\Users\HP_SSE\Desktop\Kalimba.mp3’ #路径
pygame.mixer.init() #初始化
track = pygame.mixer.music.load(filePath) #加载音乐
pygame.mixer.music.play() #播放
time.sleep(10) #播放10秒
pygame.mixer.music.stop()