[Python-de] deustche Umläute
Georg Mischler
schorsch at schorsch.com
Fri Jan 18 07:23:10 EST 2002
Josef Cihal wrote:
> Hi,
> es werden in meinem Script keine deutsche Umläute gelese.
> Python versteht nicht unter dem "\w" die deutsche spezielle Zeichen(Umläute
> sind nicht inkludiert).
>
> 1.Ich habe nur kurz www untersucht.
> 2.Dieses Problem wurde schon in Mail List besprochen, trotzdem bitte ich um
> einen Verweis oder kleine Hilfe.
>
> CODE:
> line = "OPB_123 abcdä"
> regexp =
> re.compile(r"(?P<item_name>OPB_\w*.\w*)\t(?P<german_text>\w*)\t?(?P<english_
> text>\w*)?")
> result =regexp.search(line)
> if result:
> res = result.group('item_name')
> text = result.group('german_text')
> print text
> >abcd
Aus der Bibliotheksreferenz zum Standardmodul re:
http://www.python.org/doc/current/lib/re-syntax.html
\w When the LOCALE and UNICODE flags are not specified, matches any
alphanumeric character; this is equivalent to the set [a-zA-Z0-9_]. With
LOCALE, it will match the set [0-9_] plus whatever characters are defined
as letters for the current locale. If UNICODE is set, this will match the
characters [0-9_] plus whatever is classified as alphanumeric in the
Unicode character properties database.
Ist doch nicht wirklich schwer zu verstehen, oder?
Falls du wirklich gar kein Englisch verstehen solltest, dann
wird auf Dauer kaum ein Weg an folgendem Buch vorbei fuehren:
http://www.suse.de/de/products/books/data/data_buecher/3_8272_5959_2.html
-schorsch
--
Georg Mischler -- simulations developer -- schorsch at schorsch.com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/
More information about the Python-de
mailing list