Python file input string: how to handle escaped unicode characters?

You want to use the unicode_escape codec: >>> x = 'Gro\\u00DFbritannien' >>> y = unicode(x, 'unicode_escape') >>> print y Großbritannien See the docs for the vast number of standard encodings that come as part of the Python standard library.

1 Nice. This one had escaped me. – Tim Pietzcker May 11 '10 at 14:38.

Use the built-in 'unicode_escape' codec: >>> file = open('test. Txt', 'r') >>> input = file.readline() >>> input 'Gro\\u00DFbritannien\n' >>> input. Decode('unicode_escape') u'Gro\xdfbritannien\n' You may also use codecs.open(): >>> import codecs >>> file = codecs.

Open('test. Txt', 'r', 'unicode_escape') >>> input = file.readline() >>> input u'Gro\xdfbritannien\n' The list of standard encodings is available in the Python documentation: http://docs.python.org/library/codecs.html#standard-encodings.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions