• Python: 3.8.11
  • OS: Ubuntu Kylin 20.04
  • Conda: 4.10.1
  • Jupyter lab: 3.1.4

code

my_dict = {'child': 'rat'.'ugly': 'cattle'.'Yin': 'the tiger'.'frame': 'rabbit'.'he': 'dragon'.'third': 'snakes'.'lunch': 'the horse'.'not': 'sheep'.'申': 'monkey'.The 'unitary': 'chicken'.'xu-gou': 'dog'.'hai': 'pig'}
Copy the code
type(my_dict.items()), my_dict.items()

(dict_items,
 dict_items([('child'.'rat'), ('ugly'.'cattle'), ('Yin'.'the tiger'), ('frame'.'rabbit'), ('he'.'dragon'), ('third'.'snakes'), ('lunch'.'the horse'), ('not'.'sheep'), ('申'.'monkey'), (The 'unitary'.'chicken'), ('xu-gou'.'dog'), ('hai'.'pig')))Copy the code
for item in my_dict.items():
    print(item)

('child'.'rat')
('ugly'.'cattle')
('Yin'.'the tiger')
('frame'.'rabbit')
('he'.'dragon')
('third'.'snakes')
('lunch'.'the horse')
('not'.'sheep')
('申'.'monkey')
(The 'unitary'.'chicken')
('xu-gou'.'dog')
('hai'.'pig')
    
Copy the code

Knowledge extension

help(dict.items)


Help on method_descriptor:

items(...)
    D.items() -> a set-like object providing a view on D's items


Copy the code

The resources

  • 41. How is the order of dict.keys () determined?

Learning to recommend

  • Python documentation – English
  • Python documentation – Chinese
  • Python code PEP
  • Google version of the Python specification
  • Python source code
  • Python PEP
  • Optimal kirin
  • The nuggets platform
  • Gitee platform


Python is open source, cross-platform, interpretive, interactive, and worth learning. Python’s design philosophy: elegant, unambiguous, simple. Advocate one way, preferably only one way to do one thing. Code should be written in accordance with specifications to facilitate communication and understanding. Every language has its own unique ideas. Beginners need to change their thinking, practice and accumulate.