Sound alarm when code finishes

前端 未结 11 811
离开以前
离开以前 2021-01-29 17:42

I am in a situation where my code takes extremely long to run and I don\'t want to be staring at it all the time but want to know when it is done.

How can I make the (Py

11条回答
  •  被撕碎了的回忆
    2021-01-29 18:14

    See: Python Sound ("Bell")
    This helped me when i wanted to do the same.
    All credits go to gbc

    Quote:

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

提交回复
热议问题