advice on this little script
Terry Reedy
tjreedy at udel.edu
Thu Mar 9 18:33:55 EST 2006
"John Salerno" <johnjsal at NOSPAMgmail.com> wrote in message
news:zNKdnYC8ALKCKJLZRVn-qg at rcn.net...
> Ben Cartwright wrote:
>> BartlebyScrivener wrote:
>>> What about a console beep? How do you add that?
>>>
>>> rpd
>>
>> Just use ASCII code 007 (BEL/BEEP):
>>
>> >>> import sys
>> >>> sys.stdout.write('\007')
>>
>> Or if you're on Windows, use the winsound standard module.
>
> I'd prefer to be platform neutral when possible. Is the first option
> that, or does this change depending on OS?
It is display dependent what display does with control codes. \007 is ANSI
ascii control char which only works to beep on ansi terminals or emulation
thereof. On PCs and Windows, displays have extended char set that prints
most all char codes. \007 prints as a square box. IBM EBCDIC terminals
would probably do third thing.
Terry Jan Reedy
More information about the Python-list
mailing list