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. I guess this is what you would call a raw Python string. I want to convert those four characters ( in C-think, say "\\012" ) into a single character and put it in a new string.
There's probably a simple way to do it, but I haven't figured it out. What I've done so far is to step through the string, character by character. Normal characters are appended onto a new string. If I come across a '\' character, I look for the next three numeric characters. But I don't know how to convert this code into a single character and append it onto the new string. I'm sure what I'm doing is long and convoluted. Any suggestions would be appreciated. Dan -- http://mail.python.org/mailman/listinfo/python-list