Home>Article>Backend Development> Detailed explanation of the use of dictionary dict in Python
This article mainly introduces the simple definition of Python and the method of using dictionaries. It analyzes the principles, composition, definition and usage of Python dictionaries in the form of simple examples. Friends in need can refer to the examples in this article.
Describes how to simply define and use dictionaries in Python. Share it with everyone for your reference, the details are as follows:
#coding=utf8 print ''''' Python中的字典映射数据类型是由键值对构成。 python中字典一般以数字或者字符串作为键。 Python中字典的值可以是任意类型的Python对象,字典元素用大括号{}包裹。 ''' dicDefine={ 'Name':'ewang', 'Age': 28, 'Sex': 'famale', 'BirthDay':'1998/09/1' } print 'The content of dicDefind',dicDefine print 'The keys of dicDefind',dicDefine.keys( ) print 'The values of dicDefind',dicDefine.values() print 'The items of dicDefind',dicDefine.items()
Running results:
The above is the detailed content of Detailed explanation of the use of dictionary dict in Python. For more information, please follow other related articles on the PHP Chinese website!