Embedding a literal "\u" in a unicode raw string.

romano.giannetti at gmail.com romano.giannetti at gmail.com
Mon Feb 25 18:24:20 CET 2008

On Feb 25, 6:03 pm, "OKB (not okblacke)"
<brenNOSPAMb... at NObrenSPAMbarn.net> wrote:
>         I too encountered this problem, in the same situation (making
> strings that contain LaTeX commands).  One possibility is to separate
> out just the bit that has the \u, and use string juxtaposition to attach
> it to the others:
> s = ur"añado " u"$\\uparrow$"
>         It's not ideal, but I think it's easier to read than your solution
> #2.

Yes, I think I will do something like that, although... I really do
not understand why \x5c is not interpreted in a raw string but \u005c
is interpreted  in a unicode raw string... is, well, not elegant. Raw
should be raw...

Thanks anyway

More information about the Python-list mailing list