Python 2.7 Unicode Dict

Мне интересно, как я могу кодировать Dicts в Python 2.7. Когда я делаю следующее:

# coding=ISO-8859-1 Programmer = {'v': ["1","2x","3","4","5"]} Programmer.update({'x': ["1","2x","3","4","5"]}) Programmer.update({'y': ["1","2x","3","4","5"]}) Programmer.update({'z': ["1","2x","3","4","5"]}) Programmer.update({'æ': ["1","2x","3","4","5"]}) Programmer.update({'ø': ["1","2x","3","4","5"]}) Programmer.update({'å': ["1","2x","3","4","5"]}) print Programmer 

Я получил:

 {'v': ['1', '2x', '3', '4', '5'], '\xe5': ['1', '2x', '3', '4', '5'], '\xf8': ['1', '2x', '3', '4', '5'], '\xe6': ['1', '2x', '3', '4', '5'], 'y': ['1', '2x', '3', '4', '5'], 'x': ['1', '2x', '3', '4', '5'], 'z': ['1', '2x', '3', '4', '5']} 

И я хочу:

 {'v': ['1', '2x', '3', '4', '5'], 'å': ['1', '2x', '3', '4', '5'], 'ø': ['1', '2x', '3', '4', '5'], 'æ': ['1', '2x', '3', '4', '5'], 'y': ['1', '2x', '3', '4', '5'], 'x': ['1', '2x', '3', '4', '5'], 'z': ['1', '2x', '3', '4', '5']} 

РЕДАКТИРОВАТЬ:

Это мой рабочий код:

 # -*- coding: cp1252 -*- from PyQt4 import QtCore, QtGui import locale global Programmer Programmer = {u'v': ["1","2x","3","4","5"]} Programmer.update({u'x': ["1","2x","3","4","5"]}) Programmer.update({u'y': ["1","2x","3","4","5"]}) Programmer.update({u'z': ["1","2x","3","4","5"]}) Programmer.update({u'æ': ["1","2x","3","4","5"]}) Programmer.update({u'ø': ["1","2x","3","4","5"]}) Programmer.update({u'å': ["1","2x","3","4","5"]}) class Dialog(QtGui.QDialog): NumGridRows = 3 NumButtons = 3 def __init__(self): super(Dialog, self).__init__() styleComboBox = QtGui.QComboBox() styleComboBox.addItem("UI Item01") styleLabel = QtGui.QLabel("&UI Text:") styleLabel.setBuddy(styleComboBox) opgaveComboBox = QtGui.QComboBox() opgaveComboBox.addItem(u"v") opgaveComboBox.addItem(u"x") opgaveComboBox.addItem(u"å") opgaveLabel = QtGui.QLabel("&Opgave:") opgaveLabel.setBuddy(opgaveComboBox) self.programComboBox = QtGui.QComboBox() self.programComboBox.addItem("UI item02") programLabel = QtGui.QLabel("&Program:") programLabel.setBuddy(self.programComboBox) opgaveComboBox.activated[str].connect(self.changeOpgave) topLayout = QtGui.QHBoxLayout() topLayout.addWidget(styleLabel) topLayout.addWidget(styleComboBox) #topLayout.addStretch(1) topLayoutB = QtGui.QHBoxLayout() topLayoutB.addWidget(opgaveLabel) topLayoutB.addWidget(opgaveComboBox) #topLayoutB.addStretch(1) topLayoutC = QtGui.QHBoxLayout() topLayoutC.addWidget(programLabel) topLayoutC.addWidget(self.programComboBox) mainLayout = QtGui.QGridLayout() mainLayout.addLayout(topLayout, 0, 0, 1, 2) mainLayout.addLayout(topLayoutB, 1, 0, 1, 2) mainLayout.addLayout(topLayoutC, 2, 0, 1, 2) mainLayout.setRowStretch(1, 1) mainLayout.setRowStretch(2, 1) mainLayout.setColumnStretch(0, 1) mainLayout.setColumnStretch(1, 1) self.setLayout(mainLayout) self.changeStyle('Cleanlooks') self.setWindowTitle("temp test") def changeOpgave(self, opgaveName): self.programComboBox.clear() print "begin 01" print Programmer[opgaveName] if not opgaveName in Programmer: print "begin 02" self.programComboBox.addItem("Andet") else: print "go" for item in Programmer[opgaveName]: self.programComboBox.addItem(item) def changeStyle(self, styleName): QtGui.QApplication.setStyle(QtGui.QStyleFactory.create(styleName)) self.changePalette() def changePalette(self): QtGui.QApplication.setPalette(QtGui.QApplication.style().standardPalette()) if __name__ == '__main__': import sys app = QtGui.QApplication(sys.argv) dialog = Dialog() dialog.show() sys.exit(dialog.exec_()) 

я получил

 KeyError: PyQt4.QtCore.QString(u'v') KeyError: PyQt4.QtCore.QString(u'x') KeyError: "PyQt4.QtCore.QString(u'\xe5') 

При попытке выбрать из списка «opgave» (ошибка, сброшенная в строке 79)

Python - лучший язык программирования в мире.