Python-Übungsbeispiel 100
Aufgabe:Eine Liste in ein Dictionary umwandeln.
Programmanalyse:Keine.
Programmquellcode:
Beispiel
#!/usr/bin/python
# -*- coding: UTF-8 -*-
i = ['a', 'b']
l = [1, 2]
print dict([i,l])
Die Ausgabe des obigen Beispiels ist:
{'a': 'b', 1: 2}
Andere Erweiterungen
Python 100 Beispiele