2011-03-25 4 views

Répondre

9
>>> seq = [(1, 2), (3, 4), (5, 6)] 
>>> dict(seq) 
{1: 2, 3: 4, 5: 6} 

Python est pas gentil :)

Tel que défini dans le Python Docs:

The dict() constructor builds dictionaries directly from lists of key-value pairs stored as tuples. 
+0

Merci! Oui, ça l'est!!! – joeywheels