Python-Übungsbeispiel 100

Python 100例Python 100 Beispiele

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}

Python 100例Python 100 Beispiele

Andere Erweiterungen