Unicode raw string containing \u

OKB (not okblacke) brenNOSPAMbarn at NObrenSPAMbarn.net
Sun Oct 28 07:58:48 CET 2007


    	I'm trying to write a unicode raw string literal, and I seem to be 
running up against a conflict between the \uXXXX unicode character 
escape and the need to have a literal \u (i.e., backslash followed by a 
lowercase letter U) in the string.

    	If I do ur"\universe" I get a UnicodeDecodeError because (I think) 
it tries to interpret \universe as a Unicode escape.  But if I do 
ur"\\universe" I get a string that contains two backslashes followed by 
the word "universe".

    	How can I specify a unicode raw string literal that contains a 
single backslash followed by the word "universe"?

-- 
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
	--author unknown



More information about the Python-list mailing list