Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
187 views
in Technique[技术] by (71.8m points)

playback - Play simple beep with python without external library

Using only the modules that come with a standard python 2.6 installation, would it be possible to play a simple beeping noise?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you're on a Unix terminal, you can print "a" to get a terminal bell:

>>> def beep():
...     print "a"
>>> beep()

Of course, that will print a newline too… So sys.stdout.write("a") might be better. But you get the idea.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...