About 51 results
Open links in new tab
  1. dictionary - What is the difference between dict.items () and dict ...

    The original remains for backwards compatibility. One of Python 3’s changes is that items() now return views, and a list is never fully built. The iteritems() method is also gone, since items() in Python 3 …

  2. python - Dictionary Iterating -- for dict vs for dict.items () - Stack ...

    for keyvalue in dict.items(): key, value = keyvalue[0], keyvalue[1] Remember that a for loop always iterates over the individual elements of the iterator you give it. dict.items() returns a list-like object of …

  3. python - When should iteritems () be used instead of items ()? - Stack ...

    Nov 1, 2018 · 13 As the dictionary documentation for and would tell you, in python 2 items returns a list, while iteritems returns a iterator. In python 3, items returns a , which is pretty much the same as an …

  4. How does python's dictionary.items () function work under the hood

    May 19, 2015 · How does python's dictionary.items () function work under the hood Ask Question Asked 10 years, 9 months ago Modified 10 years, 9 months ago

  5. dict.items () in python dictionary return type - Stack Overflow

    Apr 26, 2016 · It returns a list of items (in python3 dict_items object), that you cannot assign them to two variable. If you want to separately get the keys and values you can use dict.keys() and dict.values() …

  6. python - Как работает dict.items ()? - Stack Overflow на русском

    Jul 11, 2022 · Вот сколько работал с dict.items() - никогда вопросов не возникало, потому как всегда предполагал, что он .items() всегда должен возвращать пару: ключ, значение. print({1: …

  7. python - Difference between .items () and .keys () - Stack Overflow

    Dec 20, 2012 · Difference between .items () and .keys () Ask Question Asked 13 years, 2 months ago Modified 11 years, 5 months ago

  8. Get unique values from a list in python - Stack Overflow

    Oct 15, 2012 · Then, if you want to uniquely append items to a list you just call appendunique on a UniqueList. Because it inherits from a list, it basically acts like a list, so you can use functions like …

  9. python - Why I get 'list' object has no attribute 'items'? - Stack Overflow

    Nov 27, 2015 · Why I get 'list' object has no attribute 'items'? Asked 10 years, 3 months ago Modified 10 years, 3 months ago Viewed 214k times

  10. python - What are dict_keys, dict_items and dict_values ... - Stack ...

    Oct 20, 2018 · The What's new in 2.7 document is one place these are introduced. These "views" were introduced (proposed here) for Python 3 (and backported to 2.7, as you've seen) to serve as a best …