【python】用Python写一段音乐(winsound)

什么是winsound

  • winsound模块提供对Windows平台的基本声音播放功能的访问
from winsound import Beep

def sound():
    Beep(880,250)

    Beep(988,250)

    Beep(523*2,600)

    Beep(988,300)

    Beep(523*2,600)

    Beep(659*2,600)

    Beep(988,1000)

    Beep(659,250)

    Beep(659,250)

    Beep(880,600)

    Beep(784,300)

    Beep(880,600)

    Beep(523*2,600)

    Beep(784,1000)
    
    Beep(659,600)

    Beep(698,800)

    Beep(659,300)

    Beep(698,600)

    Beep(523*2,600)

    Beep(659,980)

    Beep(523*2,250)

    Beep(523*2,250)

    Beep(523*2,250)

    Beep(988,600)

    Beep(739,300)

    Beep(739,600)

    Beep(988,600)

    Beep(988,1000)
    
    Beep(880,250)

    Beep(988,250)

    Beep(523*2,600)

    Beep(988,300)

    Beep(523*2,600)

    Beep(659*2,600)

    Beep(988,1000)

    Beep(659,250)

    Beep(659,250)

    Beep(880,600)

    Beep(784,300)

    Beep(880,600)

    Beep(523*2,600)

    Beep(784,1000)
    
    Beep(659,600)

    Beep(698,800)

    Beep(659,300)

    Beep(698,600)

    Beep(523*2,600)

    Beep(659,980)

    Beep(523*2,250)

    Beep(523*2,250)

    Beep(523*2,250)

    Beep(988,600)

    Beep(739,300)

    Beep(739,600)

    Beep(988,600)

    Beep(988,1000)
    #天空之城
    
sound()


    



关于winsound的详细教程:https://www.jianshu.com/p/0628abdd38f4

你可能感兴趣的:(python的最开始的入门,Python)