Embedded 'C' problem?

Samuel Schulenburg samschul at pacbell.net
Sat Jun 2 21:06:04 EDT 2001


"Pete Shinners" <shredwheat at mediaone.net> wrote in message news:<Mm9S6.64702$154.21487848 at typhoon.we.rr.com>...
> "Samuel Schulenburg" <samschul at pacbell.net> wrote
> >   File "<string>", line 1
> > print """EB70:|30 E8 8A 17  00 00 66 89  04 9F 83 C4  08 43 3B 5C
> > 0.....f......C;\"""
> >
> >                    ^
> > SyntaxError: invalid token
> >
> > The problem is final "\" in the origional string is interfering with
> > the final tripple quote forming a \""" which is interprited as an
> > escape sequence.
> 
> for this problem, just use a double backslash at the end. you
> could also place an r at the front of the string, which will
> treat it as a raw string, giving backslash no special meaning.
> 
> 
> r"""5c 0......f.....C:\"""

The problem is that I have no control over the charactors that make up
ucMsgStr. These characters are the ASCII conversion of the previous 16
hex values. i.e. a hex memory dump routine.
EB70:|30 E8 8A 17  00 00 66 89  04 9F 83 C4  08 43 3B 5C
0.....f......C;\



More information about the Python-list mailing list