beep

Charles G Waldman cgw at fnal.gov
Wed Jul 28 10:42:36 EDT 1999


Stephane Conversy writes:
 > Hi all.
 > 
 > How to make the system beep with python ?

Not guaranteed to work on all systems or in all situations (e.g. if
output is redirected to a file), but "print chr(7)" works most of the
time.

You could get around the I/O redirection problem by doing something
like this:

def beep()
    f=open('/dev/tty','w')
    f.write(chr(7))
    f.close()
 
but it would not be portable to Windows.






More information about the Python-list mailing list