Python 播放mp3文件

# -*- coding: utf-8 -*-
"""
Created on Sun Jun  9 23:03:18 2019
QQ群:476842922(欢迎加群讨论学习)
@author: Administrator
"""

import pygame
import time

# 音频初始化
pygame.mixer.init()
# 加载音频文件路径 (路径必须真实存在,音频文件格式支持mp3/ogg等格式)
pygame.mixer.music.load(r'C:\\Users\\Administrator\\code\\able.mp3')
pygame.mixer.music.play()
time.sleep(2)

Python 播放mp3文件_第1张图片

你可能感兴趣的:(代码)