How to replace unicode characters by ascii characters in Python (perl script given)?

Posted by Frank on Stack Overflow See other posts from Stack Overflow or by Frank
Published on 2010-04-23T18:01:36Z Indexed on 2010/04/23 18:03 UTC
Read the original article Hit count: 187

Filed under:
|
|
|

I am trying to learn python and couldn't figure out how to translate the following perl script to python:

#!/usr/bin/perl -w                     

use open qw(:std :utf8);

while(<>) {
  s/\x{00E4}/ae/;
  s/\x{00F6}/oe/;
  s/\x{00FC}/ue/;
  print;
}

The script just changes unicode umlauts to alternative ascii output. (So the complete output is in ascii.) I would be grateful for any hints. Thanks!

© Stack Overflow or respective owner

Related posts about python

Related posts about unicode