Is Python's dict_items() a constructor that is inaccessible to users?
I was learning Python dictionaries at W3Schools: car = { "brand": "Ford", "model": "Mustang", "year": 1964 } x = car.items() print(x) I get: dict_items([('brand', 'Ford'), ('model', 'Mustang'), ('year', 1964)]) Demo here: https://onecompiler.com/python/459cgc42u The dict_items looks like a conversion function or class constructor, but it is not recognized at the command line: >>> dict_items([('brand', 'Ford'), ('model', 'Mustang'), ('year', 1964)]) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'dict_items' is not defined The most authoritative explanati
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.