"Dan" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I've having trouble coming to grip with Python strings.
>
> I need to send binary data over a socket.  I'm taking the data from a
> database.  When I extract it, non-printable characters come out as a
> backslash followed by a three numeric characters representing the
> numeric value of the data.

Are you sure that the printable expansion is actually in the string itself, 
and not just occurring when you 'look' at the string by printing it -- as 
in...

>>> s='1\001b'
>>> s
'1\x01b'
>>> len(s)
3
?
>  I guess this is what you would call a raw Python string.

No such thing.  There are only strings (and unicode strings).  'raw' only 
applies to a mode of interpreting string literals in the process of turning 
them into bytes or unicode.

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to