Python Sound (“Bell”)

后端 未结 6 1047
无人共我
无人共我 2020-11-29 04:03

I\'d like to have a python program alert me when it has completed its task by making a beep noise. Currently, I use import os and then use a command line spee

6条回答
  •  清酒与你
    2020-11-29 04:19

    Have you tried :

    import sys
    sys.stdout.write('\a')
    sys.stdout.flush()
    

    That works for me here on Mac OS 10.5

    Actually, I think your original attempt works also with a little modification:

    print('\a')
    

    (You just need the single quotes around the character sequence).

提交回复
热议问题