putchar(8)

Dave Angel davea at ieee.org
Fri Oct 16 23:21:45 EDT 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