播放音乐

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()

猜你喜欢

转载自blog.csdn.net/weixin_42669661/article/details/81390778