import time
import pygame
list = []
file_1 = r'C:\Users\lenovo\Desktop\muise\薛之谦 - 意外VIP.mp3'
file_2 = r'C:\Users\lenovo\Desktop\muise\薛之谦 - 你还要我这样.mp3'
file_3 = r'C:\Users\lenovo\Desktop\muise\薛之谦 - 演员.mp3'
list.append(file_1)
list.append(file_2)
list.append(file_3)
for i in range(3):
a = eval(input('请输入播放的歌曲:'))
if a == 1:
pygame.mixer.init()
print("播放音乐1")
track = pygame.mixer.music.load(file_1)
if 'VIP' in file_1:
print('需要开通VIP才可以播放')
else:
pygame.mixer.music.play()
time.sleep(10)
pygame.mixer.music.stop()
elif a == 2:
pygame.mixer.init()
print("播放音乐2")
track = pygame.mixer.music.load(file_2)
pygame.mixer.music.play()
time.sleep(10)
pygame.mixer.music.stop()
elif a == 3:
pygame.mixer.init()
print("播放音乐3")
track = pygame.mixer.music.load(file_3)
pygame.mixer.music.play()
time.sleep(10)
pygame.mixer.music.stop()
转载自原文链接, 如需删除请联系管理员。
原文链接:音乐,转载请注明来源!