Python Practice Example 100

Python 100例Python 100 Examples

Problem:Convert a list to a dictionary.

Program analysis:None.

Program source code:

Example

#!/usr/bin/python # -*- coding: UTF-8 -*- i = ['a', 'b'] l = [1, 2] print dict([i,l])

The output of the above example is:

{'a': 'b', 1: 2}

Python 100例Python 100 Examples

Other Extensions