German umlaut in a string.
Lukas Kasprowicz
nospam at maniacxs.de
Tue Aug 12 15:45:41 EDT 2003
Hi Leszek,
When I create a string with
<variable>="String"
It works!
But I have a string that was converted from a tuple to a string.
In this case it doesen?t work.
I can substitute everything from the String that was converted from a tuple
except the german umlaut. I take the tuple from a database and i get all
the umlaut from there as "\\x<HEX-CODE-ASCI>"
Changing is NOT possible with "re.sub"
This was my fault...
in the variable "test" i have written in the first tread there is only one
backslash!!!!!!!!!!
greetz Lukasz
Leszek Krupi?ski wrote:
> It works for you?
>
>>>> test = "some\\xf6thing"
>>>> print re.sub("\\xf6", "%F6", test)
> some\xf6thing
>
> (Python 2.3)
>
>>>> exclusion = "some\xf6thing"
>>>> exclusion = re.sub("\\xf6", "%F6", exclusion)
>>>> print exclusion
> some%F6thing
>
> I believe that problem is in slashes.
>
> Leon
--
---------------------------------------------------------
Das einzige Mittel gegen Aberglauben ist Wissenschaft.
(Henry Thomas Buckle)
More information about the Python-list
mailing list