zoukankan      html  css  js  c++  java
  • Python Dictionary's Key Value items

    代码
    >>> DictTest={"key1":"value1","key2":"value2","key3":"value3"}
    >>> DictTest
    {
    'key3': 'value3', 'key2': 'value2', 'key1': 'value1'}
    >>> DictTest.keys()
    [
    'key3', 'key2', 'key1']
    >>> DictTest.values()
    [
    'value3', 'value2', 'value1']
    >>> DictTest.items()
    [(
    'key3', 'value3'), ('key2', 'value2'), ('key1', 'value1')]

    Notes:

    1. The keys method of a dictionary returns a list of all the keys. The list is not in the order in which the dictionary was defined (remember that elements in a dictionary are unordered), but it is a list.
    2. The values method returns a list of all the values. The list is in the same order as the list returned by keys, so params.values()[n] == params[params.keys()[n]] for all values of n.
    3. The items method returns a list of tuples of the form (key, value). The list contains all the data in the dictionary.
    Work for fun,Live for love!
  • 相关阅读:
    css
    css笔记
    css笔记
    echarts
    css笔记
    跨域
    JS案例
    html2canvas
    echarts
    echarts
  • 原文地址:https://www.cnblogs.com/allenblogs/p/1804256.html
Copyright © 2011-2022 走看看