Python Practice Example 100
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}
Other Extensions
Python 100 Examples