putchar(8)

Dave Angel davea at ieee.org
Sat Oct 17 05:21:45 CEST 2009



Jason Tackaberry wrote:
> On Fri, 2009-10-16 at 12:01 -0700, gervaz wrote:
>   
>> Hi all, is there in python the equivalent of the C function int putchar
>> (int c)? I need to print putchar(8).
>>     
>
>   
>>>> print '\x08'
>>>>         
>
> or:
>
>   
>>>> print chr(8)
>>>>         
>
>
>
>   
If I recall correctly, putchar() takes an int value 0-255 and outputs a 
single character to stdout.  So the equivalent would be:

sys.stdout.write(char(c))

print does other stuff, which you presumably do not want.

DaveA




More information about the Python-list mailing list