在我看来,python打印无法在列表,字典和元组中打印德语变音符号。我该如何更改?
# -*- coding: cp1252 -*-
print 'ÄÖÜ' #'ÄÖÜ'
x = 'ÄÖÜ'
print x #'ÄÖÜ'
x = ['ÄÖÜ',]
print x #['\xc4\xd6\xdc']
print x[0] #'ÄÖÜ'
x = [u'ÄÖÜ',]
print x #['\xc4\xd6\xdc']
print x[0] #'ÄÖÜ'
x = {'Ä': 'Ü'}
print x #{'\xc4': '\xdc'}
print x['Ä'] #'Ü'
答案 0 :(得分:-2)
将编码更改为此:
# -*- coding: cp852 -*-