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

    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. 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 …

  3. 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 …

  4. python - How to remove items from a list while iterating ... - Stack ...

    Oct 23, 2012 · It's assigning to a list slice that just happens to be the entire list, thereby replacing the list contents within the same Python list object, rather than just reseating one reference (from the …

  5. python - How do I split a list into equally-sized chunks ... - Stack ...

    How do I split a list of arbitrary length into equal sized chunks? See also: How to iterate over a list in chunks. To chunk strings, see Split string every nth character?.

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

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

  7. python - How to concatenate (join) items in a list to a single string ...

    Sep 17, 2012 · For handling a few strings in separate variables, see How do I append one string to another in Python?. For the opposite process - creating a list from a string - see How do I split a …

  8. 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

  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, 4 months ago Modified 10 years, 4 months ago Viewed 214k times

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

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