{"id":4952,"date":"2020-11-13T07:39:36","date_gmt":"2020-11-13T02:09:36","guid":{"rendered":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/?p=4952"},"modified":"2021-06-15T07:53:32","modified_gmt":"2021-06-15T02:23:32","slug":"python-iteritems","status":"publish","type":"post","link":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/","title":{"rendered":"Python Iteritems And dict.items() Vs. dict.iteritems()"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_22 counter-hierarchy ez-toc-transparent\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" style=\"display: none;\"><i class=\"ez-toc-glyphicon ez-toc-icon-toggle\"><\/i><\/a><\/span><\/div>\n<nav><ul class=\"ez-toc-list ez-toc-list-level-1\"><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#What_is_Python_Iteritems\" title=\"What is Python Iteritems?\">What is Python Iteritems?<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#dictitems_Vs_dictiteritems_in_Python\" title=\"dict.items() Vs. dict.iteritems() in Python\">dict.items() Vs. dict.iteritems() in Python<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#Python_2_code_to_demonstrate_dictiteritems\" title=\"Python 2 code to demonstrate dict.iteritems():\">Python 2 code to demonstrate dict.iteritems():<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#Python_3_code_to_demonstrate_dictitems\" title=\"Python 3 code to demonstrate dict.items():\">Python 3 code to demonstrate dict.items():<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#Is_Itertools_Infinite_in_Python\" title=\"Is Itertools Infinite in Python?\">Is Itertools Infinite in Python?<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#Errors_while_importing_itertools_in_Python\" title=\"Errors while importing itertools in Python\">Errors while importing itertools in Python<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#DataFrame_in_Python\" title=\"DataFrame in Python\">DataFrame in Python<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#Dictionary_sorting_using_python_iteritems\" title=\"Dictionary sorting using python iteritems()\">Dictionary sorting using python iteritems()<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#Must_Read\" title=\"Must Read\">Must Read<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"What_is_Python_Iteritems\"><\/span>What is Python Iteritems?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Iteritems in Python is a function that returns an iterator of the dictionary&#8217;s list. Iteritems are in the form of (keiy, value) tuple pairs. Python default dictionary iteration uses this method.<\/p>\n\n\n\n<h3>What&#8217;s a Dictionary in Python<\/h3>\n\n\n\n<p>Dictionaries in Python are unordered, changeable, and indexed\u2014written with curly brackets having keys: value pair.<\/p>\n\n\n\n<h3>Example of dictionary in Python:<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ntdict = {\n \u201cbrand\u201d = \u201cHonda\u201d,\n \u201cmodel\u201d = \u201cPleasure\u201d,\n \u201cyear\u201d= \u201c2006\u201d\n }\n<\/pre><\/div>\n\n\n<h3>Explanation<\/h3>\n\n\n\n<p>Here brand, model, and year are the tdict dictionary&#8217;s keys. And Honda, Pleasure, and 2006 are their respective values.<\/p>\n\n\n\n<p>Loops and iteritems() can be used to create a dictionary in Python.<\/p>\n\n\n\n<h2><span class=\"ez-toc-section\" id=\"dictitems_Vs_dictiteritems_in_Python\"><\/span>dict.items() Vs. dict.iteritems() in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Both the function does almost the same thing, i.e., dictionary iteration, with a very slight difference between them \u2013&nbsp;<\/p>\n\n\n\n<p>dict.items() &#8211; This function returns a copy of the dictionary\u2019s list. It is present in the Python 3 version and exists in the Python 2 versions.<\/p>\n\n\n\n<p>dict.iteritems() \u2013 This function returns an iterator of the dictionary&#8217;s list. It is a python 2 version feature and got omitted in the Python 3 versions.<\/p>\n\n\n\n<p>Note: Python&#8217;s future library ensures compatibility with Python<em>&nbsp;2.6\/2.7 and 3.x versions. Python&#8217;s future module has much stuff already done in an optimized way.<\/em><\/p>\n\n\n\n<h2><span class=\"ez-toc-section\" id=\"Python_2_code_to_demonstrate_dictiteritems\"><\/span><strong>Python 2 code to demonstrate dict.iteritems():<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ndict ={ \n&quot;Name&quot;: &quot;Riya&quot;, \n&quot;City&quot;: &quot;New York&quot;, \n&quot;Country&quot;: &quot;USA&quot;\n} \n  \nfor i in dict.iteritems(): \n      \n    # prints the items \n    print(i) \n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n('Name', 'Riya')\n('City', 'New York')\n('Country', 'USA')\n<\/pre><\/div>\n\n\n<h2 id=\"h-python-3-code-to-demonstrate-dict-items\"><span class=\"ez-toc-section\" id=\"Python_3_code_to_demonstrate_dictitems\"><\/span><strong>Python 3 code to demonstrate dict.items():<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndict ={ \n&quot;Name&quot;: &quot;Riya&quot;, \n&quot;City&quot;: &quot;New York&quot;, \n&quot;Country&quot;: &quot;USA&quot;\n  } \n\nprint(&quot;d.items() = &quot;) \nfor i in dict.items(): \n\n# saves as a copy \nprint(dict.items()) \n<\/pre><\/div>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; gutter: false; title: ; notranslate\" title=\"\">\ndict_items(&#91;(\u2018Name\u2019, \u2018Riya\u2019), (\u2018City\u2019, \u2018New York\u2019), (\u2018Country\u2019, \u2018USA\u2019)])\n<\/pre><\/div>\n\n\n<p><strong>Explanation:<\/strong><\/p>\n\n\n\n<p>The above two python codes demonstrate the use of dict.iteritems() and dict.tems() in Python 2 and Python 3. dict.items() works in python 2 but never generates the list entirely. As a result, no one uses it. However, using dict.iteritems() does not create any result and raises an error.<\/p>\n\n\n\n<h2><span class=\"ez-toc-section\" id=\"Is_Itertools_Infinite_in_Python\"><\/span>Is Itertools Infinite in Python?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Itertools used for iterations present in the python 3 library are infinite iterators like count(), cycle(), repaeat(). Iterators terminating on shortest input sequence like accumulate(), chain(), compress(), dropwhile(), filterfalse(),islice(), strmap(),etc each having very unique distinct results. Combinaton iterators presenting the iterator module of python are product(), permutations(), combinations() and combination_with_replacement().<\/p>\n\n\n\n<h2><span class=\"ez-toc-section\" id=\"Errors_while_importing_itertools_in_Python\"><\/span>Errors while importing itertools in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>While importing itertools into a python program, numerous errors crop up, the most common one being&nbsp;<strong>attribute error<\/strong>. Wrong module name or importing the faulty module generates attribute errors. As a result, you have to use the exception handling technique and iteritems while <a href=\"https:\/\/www.pythonpool.com\/python-iterate-through-list\/\" target=\"_blank\" rel=\"noreferrer noopener\">iteration<\/a> of long lists in dictionaries to avoid AttributeError.<\/p>\n\n\n\n<ol><li>in Python 3<\/li><\/ol>\n\n\n\n<p>In Python, items() is time-consuming and memory exhausting. The items() function returns a copy, whereas iteritems() is less time consuming and less memory exhausting. However, since items() performed almost the same task as iteritems(). The latter has been removed from Python 3. Now, items() return iterators and never builds a list entirely in Python 3.<\/p>\n\n\n\n<h3>dict.iteritems() to dict .items() in Python 3<\/h3>\n\n\n\n<p>If one uses Python 3, It&#8217;s common to incur an attribute error reading &#8216;dict&#8217; has no attributes&#8217; iteritems.&#8217; This error is so because in python 3 the functionality of dict.iteritems() has been transferred to dict.items(). Programmers need to use dict.items() for iteration of the dictionary while working in python 3. Python 3 no longer have dict.iteritems(). Thus can no longer be used. dict.iterkeys() and dict.itervalues() have also been removed from Python 3. Instead one needs to use dict.keys() and dict.values() for error-free execution of the program.<\/p>\n\n\n\n<h4><strong>Both .items() and .iteritems() in Python 2<\/strong><\/h4>\n\n\n\n<p>In python 2, both .items() and .iteritems() functions are available. dict.items() copied all tuples to create the new list, which had a huge memory impact. The later versions of python 2 created dict.iteritems(), which returned just the iterator objects. Thus consuming less memory and making the programs more efficient.<\/p>\n\n\n\n<h2><span class=\"ez-toc-section\" id=\"DataFrame_in_Python\"><\/span>DataFrame in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>DataFrame is a two-dimensional data structure with rows and columns of potentially different types. It is the most commonly used Pandas object or by importing values from an excel file. The first line of creation of DataFrame in both methods requires import pandas in the program. For example \u2013 import pandas as PD as the first line and DataFrame creation as df = PD.DataFrame().<\/p>\n\n\n\n<h3>DataFrame.iteritems()<\/h3>\n\n\n\n<p>DataFrame.iteritems() or DataFrame.items() iterates over data frame columns, i.e. (column name, series) pairs are returning a tuple with the column name and the content as a series. Dataframes preserves the data type of elements along its column. DataFrame.iterrows iterates over(index, series) pairs yielding an<a target=\"_blank\" href=\"https:\/\/en.scratch-wiki.info\/wiki\/Index#:~:text=An%20Index%20is%20a%20numerical,key%20points%20to%20a%20value.\" rel=\"noreferrer noopener\">&nbsp;index<\/a>&nbsp;of the row and the row&#8217;s data as a series. Since iterrows returns a series for each row, it does not preserve data types across the rows.<\/p>\n\n\n\n<p>intertupes() are better used to preserve data while iterating over rows. Intertupes() iterates over rows as named tuples, with the first field being index. And the following fields being column values and is generally faster than iterrows. Since we can iterate over DataFrames like dictionary using the above functions. DataFrames uses key-value pairs to compare them.&nbsp;<\/p>\n\n\n\n<h2><span class=\"ez-toc-section\" id=\"Dictionary_sorting_using_python_iteritems\"><\/span>Dictionary sorting using python iteritems()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Dictionaries in Python are unsorted and iteritems() function can help to do it.&nbsp;<\/p>\n\n\n\n<p>\u2022&nbsp;<strong>Sorting by key&nbsp;<\/strong>\u2013 Method iteritems() returns an iterator of the key-value tuples. Applying the sorted() function to the return value returns a list of tuples sorted by key.<\/p>\n\n\n\n<p>\u2022 Sorting by value &#8211; Specifying a comparison function to the sorted(). The function that receives two tuples to compare uses cmp() to compare each second element. Thus, sorting by value.<\/p>\n\n\n\n<p><strong>Note:<\/strong><\/p>\n\n\n\n<p>Python iteritems is a (<strong>Python<\/strong>&nbsp;v2. x) version and got omitted in (<strong>Python<\/strong>&nbsp;v3. x) version.<\/p>\n\n\n\n<h2><span class=\"ez-toc-section\" id=\"Must_Read\"><\/span>Must Read<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul><li><a target=\"_blank\" href=\"https:\/\/www.pythonpool.com\/python-super\/\" rel=\"noreferrer noopener\">Introduction to Python Super With Examples<\/a><\/li><li><a target=\"_blank\" href=\"https:\/\/www.pythonpool.com\/python-help-function\/\" rel=\"noreferrer noopener\">Python Help Function<\/a><\/li><li><a target=\"_blank\" href=\"https:\/\/www.pythonpool.com\/python-sys-exit\/\" rel=\"noreferrer noopener\">Why is Python sys.exit better than other exit functions?<\/a><\/li><li><a target=\"_blank\" href=\"https:\/\/www.pythonpool.com\/python-bitstring\/\" rel=\"noreferrer noopener\">Python Bitstring: Classes and Other Examples | Module<\/a><\/li><\/ul>\n\n\n\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we learned what python iteritems is. We also learned the difference between dict.items() and dict.iteritems(). In conclusion, we can say Dict.items() yields a list of tuples. It&#8217;s time-consuming and memory exhausting, whereas dict.iteritems() is an iter-generator method that yields tuples also. It&#8217;s time-consuming and less memory exhausting.<\/p>\n\n\n\n<p>Still have any doubts or questions, do let me know in the comment section below. I will try to help you as soon as possible.<\/p>\n\n\n\n<p><strong><em>Happy Python!<\/em><\/strong><\/p>\n\n\n\n<p><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Contents What is Python Iteritems?dict.items() Vs. dict.iteritems() in PythonPython 2 code to demonstrate dict.iteritems():Python 3 code to demonstrate dict.items():Is Itertools Infinite in Python?Errors while importing &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Python Iteritems And dict.items() Vs. dict.iteritems()\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/#more-4952\" aria-label=\"More on Python Iteritems And dict.items() Vs. dict.iteritems()\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":5242,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[4047,15],"tags":[2472,2470,2475,2469,2473,2471,2474,2477,2476],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v18.1 (Yoast SEO v18.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Iteritems And dict.items() Vs. dict.iteritems() - Python Pool<\/title>\n<meta name=\"description\" content=\"Iteritems in python is a function that returns an iterator of the dictionary\u2019s list in the form of (key, value) tuple pairs.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/python-iteritems\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Iteritems And dict.items() Vs. dict.iteritems()\" \/>\n<meta property=\"og:description\" content=\"What is Python Iteritems? Iteritems in Python is a function that returns an iterator of the dictionary&#039;s list. Iteritems are in the form of (keiy, value)\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/python-iteritems\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-13T02:09:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-15T02:23:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/11\/Theatre-Actor-Portfolio-Website-5.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1350\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Python Pool\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"sameAs\":[\"https:\/\/www.youtube.com\/c\/pythonpool\",\"https:\/\/twitter.com\/pythonpool\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/python-iteritems\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/11\/Theatre-Actor-Portfolio-Website-5.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/11\/Theatre-Actor-Portfolio-Website-5.png\",\"width\":1350,\"height\":650,\"caption\":\"python iteritems\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com\/python-iteritems\/#webpage\",\"url\":\"https:\/\/www.pythonpool.com\/python-iteritems\/\",\"name\":\"Python Iteritems And dict.items() Vs. dict.iteritems() - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-iteritems\/#primaryimage\"},\"datePublished\":\"2020-11-13T02:09:36+00:00\",\"dateModified\":\"2021-06-15T02:23:32+00:00\",\"description\":\"Iteritems in python is a function that returns an iterator of the dictionary\u2019s list in the form of (key, value) tuple pairs.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-iteritems\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/python-iteritems\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/python-iteritems\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Iteritems And dict.items() Vs. dict.iteritems()\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/python-iteritems\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-iteritems\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/359166b9a432f7680dff9c50035fd1ab\"},\"headline\":\"Python Iteritems And dict.items() Vs. dict.iteritems()\",\"datePublished\":\"2020-11-13T02:09:36+00:00\",\"dateModified\":\"2021-06-15T02:23:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-iteritems\/#webpage\"},\"wordCount\":999,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-iteritems\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/11\/Theatre-Actor-Portfolio-Website-5.png\",\"keywords\":[\"iteritems python\",\"iteritems python 3\",\"python 3 dict iteritems\",\"python 3 iteritems\",\"python dict iteritems\",\"python dictionary iteritems\",\"python items vs iteritems\",\"python iteritems\",\"python iteritems python 3\"],\"articleSection\":[\"Comparison\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/python-iteritems\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/359166b9a432f7680dff9c50035fd1ab\",\"name\":\"Python Pool\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g\",\"caption\":\"Python Pool\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Iteritems And dict.items() Vs. dict.iteritems() - Python Pool","description":"Iteritems in python is a function that returns an iterator of the dictionary\u2019s list in the form of (key, value) tuple pairs.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/","og_locale":"en_US","og_type":"article","og_title":"Python Iteritems And dict.items() Vs. dict.iteritems()","og_description":"What is Python Iteritems? Iteritems in Python is a function that returns an iterator of the dictionary's list. Iteritems are in the form of (keiy, value)","og_url":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/","og_site_name":"Python Pool","article_published_time":"2020-11-13T02:09:36+00:00","article_modified_time":"2021-06-15T02:23:32+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/11\/Theatre-Actor-Portfolio-Website-5.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Python Pool","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/","sameAs":["https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.youtube.com\/c\/pythonpool","https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/twitter.com\/pythonpool"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"}},{"@type":"WebSite","@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#website","url":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#primaryimage","url":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/11\/Theatre-Actor-Portfolio-Website-5.png","contentUrl":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/11\/Theatre-Actor-Portfolio-Website-5.png","width":1350,"height":650,"caption":"python iteritems"},{"@type":"WebPage","@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#webpage","url":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/","name":"Python Iteritems And dict.items() Vs. dict.iteritems() - Python Pool","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#primaryimage"},"datePublished":"2020-11-13T02:09:36+00:00","dateModified":"2021-06-15T02:23:32+00:00","description":"Iteritems in python is a function that returns an iterator of the dictionary\u2019s list in the form of (key, value) tuple pairs.","breadcrumb":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Python Iteritems And dict.items() Vs. dict.iteritems()"}]},{"@type":"Article","@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#article","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#webpage"},"author":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#\/schema\/person\/359166b9a432f7680dff9c50035fd1ab"},"headline":"Python Iteritems And dict.items() Vs. dict.iteritems()","datePublished":"2020-11-13T02:09:36+00:00","dateModified":"2021-06-15T02:23:32+00:00","mainEntityOfPage":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#webpage"},"wordCount":999,"commentCount":0,"publisher":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/11\/Theatre-Actor-Portfolio-Website-5.png","keywords":["iteritems python","iteritems python 3","python 3 dict iteritems","python 3 iteritems","python dict iteritems","python dictionary iteritems","python items vs iteritems","python iteritems","python iteritems python 3"],"articleSection":["Comparison","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/python-iteritems\/#respond"]}]},{"@type":"Person","@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#\/schema\/person\/359166b9a432f7680dff9c50035fd1ab","name":"Python Pool","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g","contentUrl":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g","caption":"Python Pool"}}]}},"_links":{"self":[{"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/4952"}],"collection":[{"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=4952"}],"version-history":[{"count":32,"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/4952\/revisions"}],"predecessor-version":[{"id":13515,"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/4952\/revisions\/13515"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/5242"}],"wp:attachment":[{"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=4952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=4952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=4952"}],"curies":[{"name":"wp","href":"https:\/\/web.archive.org\/web\/20220525235218\/https:\/\/api.w.org\/{rel}","templated":true}]}}