E
enquiring mind
I read the posting by Rehceb Rotkiv and response but don't know if it
relates to my problem in any way.
I only want to write German to the screen/console for little German
programs/exercises in python. No file w/r will be used.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Filename: 7P07png.py
# SUSE Linux 10 Python 2.4.1 gedit 2.12.0
print 'Ich zähle zwölf weiß Hüte.'
print 'Wollen Sie'
verbs = ( 'kömmen' , 'essen' , 'trinken' )
print verbs[:3]
print ' program ends '
console display is: Ich zähle zwölf weiß Hüte.
Wollen Sie
('k\xc3\xb6mmen', 'essen', 'trinken')
program ends
The first 2 print statements in German print perfectly to screen/console
but not the 3rd.
I ran it with these lines below from Rehceb Rotkiv's code but it did not
fix problem.
import sys
import codecs
I also tried unicode string u'kömmen', but it did not fix problem.
Any help/direction would be appreciated. Thanks in advance.
I found this reference section but I am not sure it applies or how to
use it to solve my problem.:
This built in setdefaultencoding(name) sets the default codec used to
encode and decode Unicode and string objects (normally ascii)and is
meant to be called only from sitecustomize.py at program startup; the
site module them removes this attribute from sys. You can call
reload(sys) to make this attriute available again but this is not a good
programming practice.
I just thought of this. I suppose because this is py source code, it
should not be German but a reference/key to u'strings' to print German
text to the screen?
The ultimate console output I seek, of course, using a while or for loop
and/or random access for second verb, for example:
Wollen Sie kömmen?
Wollen Sie essen?
Wollen Sie trinken?
relates to my problem in any way.
I only want to write German to the screen/console for little German
programs/exercises in python. No file w/r will be used.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Filename: 7P07png.py
# SUSE Linux 10 Python 2.4.1 gedit 2.12.0
print 'Ich zähle zwölf weiß Hüte.'
print 'Wollen Sie'
verbs = ( 'kömmen' , 'essen' , 'trinken' )
print verbs[:3]
print ' program ends '
console display is: Ich zähle zwölf weiß Hüte.
Wollen Sie
('k\xc3\xb6mmen', 'essen', 'trinken')
program ends
The first 2 print statements in German print perfectly to screen/console
but not the 3rd.
I ran it with these lines below from Rehceb Rotkiv's code but it did not
fix problem.
import sys
import codecs
I also tried unicode string u'kömmen', but it did not fix problem.
Any help/direction would be appreciated. Thanks in advance.
I found this reference section but I am not sure it applies or how to
use it to solve my problem.:
This built in setdefaultencoding(name) sets the default codec used to
encode and decode Unicode and string objects (normally ascii)and is
meant to be called only from sitecustomize.py at program startup; the
site module them removes this attribute from sys. You can call
reload(sys) to make this attriute available again but this is not a good
programming practice.
I just thought of this. I suppose because this is py source code, it
should not be German but a reference/key to u'strings' to print German
text to the screen?
The ultimate console output I seek, of course, using a while or for loop
and/or random access for second verb, for example:
Wollen Sie kömmen?
Wollen Sie essen?
Wollen Sie trinken?