开发者

Generate audio bell in terminal using Python

开发者 https://www.devze.com 2023-04-06 21:57 出处:网络
How can I generate audio bell in 开发者_如何转开发xterm type terminal? Simple, print the bell character. In Python:

How can I generate audio bell in 开发者_如何转开发xterm type terminal?


Simple, print the bell character. In Python:

print('\a')

From bash shell:

echo $'\a'

Note that on some terminals, the bell can be disabled. In others, the bell can be replaced with a visual bell in the shape of a flashing screen background.


print("\a") # Python 3

or

print "\a"  # Python 2

See the docs.


For a simple beep, print "\a".

The Control Codes are listed on this page, these are all the characters that should make a terminal perform an action.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号