constructing binary backslash-n

Steven Arnold stevena at neosynapse.net
Wed Sep 29 23:23:29 EDT 2004


Something seemed to screw up my message, putting two backslashes 
everywhere I put only one.  That probably led to your confusion.  It 
seems that Jeff may have been similarly confused.  I'll try again.

I want to be able to receive a letter like 'n', let's say as user 
input, and generate the single byte escape value of backslash-n or 
ASCII 10, as a string of length 1.  If the user provided the letter 
'r', I would return a string one character long, for which 
ord(my_string) == 13.  This should be equivalent to the string 
'<backslash>r'.

I imagine the solution is extremely simple and I'm missing something 
obvious, although my description of the problem up to now hasn't been. 
;-)  Is this clearer?

Thanks,
steve




More information about the Python-list mailing list