{"id":25531320,"date":"2022-07-02T22:36:40","date_gmt":"2022-07-02T17:06:40","guid":{"rendered":"https:\/\/entri.app\/blog\/?p=25531320"},"modified":"2023-04-28T11:47:46","modified_gmt":"2023-04-28T06:17:46","slug":"learn-zip-function-in-python-with-examples","status":"publish","type":"post","link":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/","title":{"rendered":"Learn Zip Function In Python With Examples"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a058de8d2133\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a058de8d2133\"  aria-label=\"Toggle\" \/><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:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#Python_zip_Function_%E2%80%93_Explained_with_Code_Examples\" >Python zip() Function \u2013 Explained with Code Examples<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#How_to_Use_the_%E2%80%98in_Operator_in_Python_to_Traverse_Iterables\" >How to Use the &#8216;in&#8217; Operator in Python to Traverse Iterables<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#Why_Using_Pythons_range_Object_is_Not_an_Optimal_Choice_Always\" >Why Using Python&#8217;s range() Object is Not an Optimal Choice Always<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#How_Pythons_zip_Function_Works\" >How Python&#8217;s zip() Function Works<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#How_the_zip_Function_Creates_an_Iterator_of_Tuples\" >How the zip() Function Creates an Iterator of Tuples<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#How_to_Use_zip_Function_in_Python\" >How to Use zip() Function 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:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#What_Happens_When_the_Iterables_are_of_Different_Lengths\" >What Happens When the Iterables are of Different Lengths?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#What_Happens_When_You_Pass_in_One_or_No_Iterable_to_the_zip_Function\" >What Happens When You Pass in One or No Iterable to the zip() Function?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#How_to_Use_the_zip_longest_Function_in_Python\" >How to Use the zip_longest() Function in Python<\/a><\/li><\/ul><\/nav><\/div>\n<header class=\"post-full-header\">\n<h1 class=\"post-full-title\"><\/h1>\n<\/header>\n<section class=\"post-full-content\">\n<div class=\"post-and-sidebar\">\n<section class=\"post-content \">Have you ever needed to loop through multiple iterables in parallel when coding in Python?In this blog, we will use Python&#8217;s <code>zip()<\/code> function to efficiently perform parallel iteration over multiple iterables.<\/section>\n<section>\n<h2 class=\"post-full-title\"><span class=\"ez-toc-section\" id=\"Python_zip_Function_%E2%80%93_Explained_with_Code_Examples\"><\/span><strong>Python zip() Function \u2013 Explained with Code Examples<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<\/section>\n<section class=\"post-content \">\n<h2 id=\"how-to-use-the-in-operator-in-python-to-traverse-iterables\"><span class=\"ez-toc-section\" id=\"How_to_Use_the_%E2%80%98in_Operator_in_Python_to_Traverse_Iterables\"><\/span><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-25520910 size-full\" src=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square.png\" alt=\"Python and Machine Learning Square\" width=\"345\" height=\"345\" srcset=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square.png 345w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-300x300.png 300w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-150x150.png 150w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-24x24.png 24w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-48x48.png 48w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-96x96.png 96w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-75x75.png 75w\" sizes=\"auto, (max-width: 345px) 100vw, 345px\" \/><\/a>How to Use the &#8216;in&#8217; Operator in Python to Traverse Iterables<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Before we go ahead and learn about the\u00a0<code>zip()<\/code> function in python, let&#8217;s quickly revisit how we use the <code>in<\/code>\u00a0operator with a\u00a0<code>for<\/code>\u00a0loop to access items in an iterable (lists, tuples, dictionaries, strings etc.). The snippet below shows the general syntax:<\/p>\n<pre class=\" language-python\"><code class=\" language-python\">for item in list_1:\r\n\t# do something on item<\/code><\/pre>\n<p>In simple terms, we tell the Python interpreter: &#8220;<em>Hey there! Please loop through\u00a0<code>list_1<\/code>\u00a0to access each\u00a0<code>item<\/code>\u00a0and do some operation on each\u00a0<code>item<\/code>.<\/em>&#8221;<\/p>\n<p>What if we had more than one list (or any iterable) ? Say,\u00a0<code>N<\/code>\u00a0lists \u2013 you may insert your favorite number in place of\u00a0<code>N<\/code>. Things may seem a bit difficult now, and the following approach won&#8217;t work:<\/p>\n<pre class=\" language-python\"><code class=\" language-python\"># Example - 2 lists, list_1 and list_2\r\n\r\nfor i1 in list_1:\r\n\tfor i2 in list_2:\r\n    \t # do something on i1 and i2<\/code><\/pre>\n<p>Please note that the above code:<\/p>\n<ul>\n<li>first taps into the first item in\u00a0<code>list_1<\/code>,<\/li>\n<li>then loops through\u00a0<code>list_2<\/code>\u00a0accessing each item in\u00a0<code>list_2<\/code>,<\/li>\n<li>then accesses the second item in\u00a0<code>list_1<\/code>,<\/li>\n<li>and loops through the whole of\u00a0<code>list_2<\/code>\u00a0again, and<\/li>\n<li>does this until it traverses the whole of\u00a0<code>list_1<\/code><\/li>\n<\/ul>\n<p>Clearly, this isn&#8217;t what we want. We need to be able to access items at a particular index from both the lists. This is precisely what is called\u00a0parallel iteration.<\/p>\n<p style=\"text-align: center;\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/course\/python-programming-course\/\" target=\"_blank\" rel=\"noopener\">&#8220;Ready to take your python skills to the next level? Sign up for a free demo today!&#8221;<\/a><\/strong><\/p>\n<h2 id=\"why-using-python-s-range-object-is-not-an-optimal-choice-always\"><span class=\"ez-toc-section\" id=\"Why_Using_Pythons_range_Object_is_Not_an_Optimal_Choice_Always\"><\/span><strong>Why Using Python&#8217;s range() Object is Not an Optimal Choice Always<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You may think of using the\u00a0<code>range()<\/code>\u00a0object with the\u00a0<code>for<\/code>\u00a0loop.\u00a0&#8220;If I know that all lists have the same number of items, can I not just use the\u00a0<code>index<\/code>\u00a0to tap into each of those lists, and pull out the item at the specified\u00a0<code>index<\/code>?&#8221;<\/p>\n<p>Well, let&#8217;s\u00a0 try. The code is in the snippet below. You know that all the lists \u2013 <code>list_1<\/code>,\u00a0<code>list_2<\/code>,&#8230;,\u00a0<code>list_N<\/code>\u00a0\u2013 contain the same number of items. And you create a\u00a0<code>range()<\/code>\u00a0object as shown below and use the index\u00a0<code>i<\/code>\u00a0to access the item at position\u00a0<code>i<\/code>\u00a0in each of the iterables.<\/p>\n<pre class=\" language-python\"><code class=\" language-python\">for i in range(len(list_1)):\r\n\t# do something on list_1[i],list_2[i],list_3[i],...,list_N[i]<\/code><\/pre>\n<p>As you might have guessed by now, this works as expected\u00a0only when all the iterables contain the same number of items.<\/p>\n<p>Consider the case where one or more of the lists are updated \u2013 say, one list may have an item removed from it, and another may have an item added to it. This would cause confusion:<\/p>\n<ul>\n<li>You may run into\u00a0<code>IndexErrors<\/code> as you are accessing items at indices that are no longer valid\u00a0because the item at the index has been removed, or<\/li>\n<li>You may\u00a0not\u00a0be\u00a0accessing newly added items at all\u00a0as they are at indices not currently in the range of accessed indices.<\/li>\n<\/ul>\n<p>Let&#8217;s now see how <code>zip() <\/code>\u00a0in Python can help us iterate through multiple lists in parallel.<\/p>\n<h4 style=\"text-align: center;\"><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;\\&quot;Experience the power of our web development course with a free demo - enroll now!\\&quot;&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:1061379,&quot;3&quot;:{&quot;1&quot;:0},&quot;4&quot;:{&quot;1&quot;:2,&quot;2&quot;:16777215},&quot;12&quot;:0,&quot;15&quot;:&quot;Roboto, RobotoDraft, Helvetica, Arial, sans-serif&quot;,&quot;16&quot;:10,&quot;23&quot;:1}\" data-sheets-hyperlink=\"https:\/\/entri.app\/course\/python-programming-course\/\"><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/course\/python-programming-course\/\" target=\"_blank\" rel=\"noopener\">&#8220;Experience the power of our web development course with a free demo &#8211; enroll now!&#8221;<\/a><\/span><\/h4>\n<h2 id=\"how-python-s-zip-function-works\"><span class=\"ez-toc-section\" id=\"How_Pythons_zip_Function_Works\"><\/span><strong>How Python&#8217;s zip() Function Works<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Let&#8217;s start by looking up the documentation for\u00a0<code>zip()<\/code>\u00a0and parse it in the subsequent sections.<\/p>\n<p><strong>Syntax<\/strong>:\u00a0<code>zip(*iterables)<\/code>\u00a0\u2013 the\u00a0<code>zip()<\/code>\u00a0function takes in one or more iterables as arguments.<\/p>\n<blockquote><p><em>Make an iterator that aggregates elements from each of the iterables.<\/em><br \/>\n<em>1. Returns an iterator of tuples, where the\u00a0i-th tuple contains the\u00a0i-th element from each of the argument sequences or iterables.<\/em><br \/>\n<em>2. The iterator stops when the shortest input iterable is exhausted.<\/em><br \/>\n<em>3. With a single iterable argument, it returns an iterator of 1-tuples.<\/em><br \/>\n<em>4. With no arguments, it returns an empty iterator.<\/em><\/p><\/blockquote>\n<h2 id=\"how-the-zip-function-creates-an-iterator-of-tuples\"><span class=\"ez-toc-section\" id=\"How_the_zip_Function_Creates_an_Iterator_of_Tuples\"><\/span><strong>How the zip() Function Creates an Iterator of Tuples<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The following illustration helps us understand how the\u00a0<code>zip()<\/code>\u00a0function works by creating an\u00a0iterator of tuples\u00a0from two input lists,\u00a0<code>L1<\/code>\u00a0and\u00a0<code>L2<\/code>. The result of calling\u00a0<code>zip()<\/code>\u00a0on the iterables is displayed on the right.<\/p>\n<figure class=\"kg-card kg-image-card\"><img loading=\"lazy\" decoding=\"async\" class=\"kg-image\" src=\"https:\/\/www.freecodecamp.org\/news\/content\/images\/2021\/07\/zipf.png\" srcset=\"https:\/\/www.freecodecamp.org\/news\/content\/images\/size\/w600\/2021\/07\/zipf.png 600w, https:\/\/www.freecodecamp.org\/news\/content\/images\/size\/w1000\/2021\/07\/zipf.png 1000w, https:\/\/www.freecodecamp.org\/news\/content\/images\/size\/w1600\/2021\/07\/zipf.png 1600w, https:\/\/www.freecodecamp.org\/news\/content\/images\/size\/w2400\/2021\/07\/zipf.png 2400w\" alt=\"zipf\" width=\"2788\" height=\"1564\" \/><\/figure>\n<ul>\n<li>Notice how the first tuple (at index\u00a0<code>0<\/code>) on the right contains 2 items, at index\u00a0<code>0<\/code>\u00a0in\u00a0<code>L1<\/code>\u00a0and\u00a0<code>L2<\/code>, respectively.<\/li>\n<li>The second tuple (at index\u00a0<code>1<\/code>) contains the items at index\u00a0<code>1<\/code>\u00a0in\u00a0<code>L1<\/code>\u00a0and\u00a0<code>L2<\/code>.<\/li>\n<li>In general, the tuple at index\u00a0<code>i<\/code>\u00a0contains items at index\u00a0<code>i<\/code>\u00a0in\u00a0<code>L1<\/code>\u00a0and\u00a0<code>L2<\/code>.<\/li>\n<\/ul>\n<p>Let&#8217;s try out a few examples.<\/p>\n<h4 style=\"text-align: center;\"><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;\\&quot;Get hands-on with our python course - sign up for a free demo!\\&quot;&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:1061443,&quot;3&quot;:{&quot;1&quot;:0},&quot;4&quot;:{&quot;1&quot;:2,&quot;2&quot;:16316664},&quot;9&quot;:0,&quot;12&quot;:0,&quot;15&quot;:&quot;Arial&quot;,&quot;16&quot;:10,&quot;23&quot;:1}\" data-sheets-hyperlink=\"https:\/\/entri.app\/course\/python-programming-course\/\"><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/course\/python-programming-course\/\" target=\"_blank\" rel=\"noopener\">&#8220;Get hands-on with our python course &#8211; sign up for a free demo!&#8221;<\/a><\/span><\/h4>\n<h2 id=\"how-to-use-python-s-zip-function-try-it-yourself-\"><span class=\"ez-toc-section\" id=\"How_to_Use_zip_Function_in_Python\"><\/span><strong>How to Use zip() Function in Python<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Try running the following examples in your favorite IDE.<\/p>\n<p>As a first example, let&#8217;s pick two lists\u00a0<code>L1<\/code>\u00a0and\u00a0<code>L2<\/code>\u00a0that contain 5 items each. Let&#8217;s call the\u00a0<code>zip()<\/code>\u00a0function and pass in\u00a0<code>L1<\/code>\u00a0and\u00a0<code>L2<\/code>\u00a0as arguments.<\/p>\n<pre class=\" language-python\"><code class=\" language-python\">L1 = [1,2,3,4,5]\r\nL2 = ['a','b','c','d','e']\r\n\r\nzip_L1L2 = zip(L1,L2)\r\n\r\nprint(zip_L1L2)\r\n# Sample Output\r\n&lt;zip object at 0x7f92f44d5550&gt;\r\n<\/code><\/pre>\n<p>Let&#8217;s cast the zip object into a list and print it out, as shown below.<\/p>\n<pre class=\" language-python\"><code class=\" language-python\">print(list(zip_L1L2))\r\n\r\n# Output\r\n[(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e')]<\/code><\/pre>\n<h2 id=\"what-happens-when-the-iterables-are-of-different-lengths\"><span class=\"ez-toc-section\" id=\"What_Happens_When_the_Iterables_are_of_Different_Lengths\"><\/span><strong>What Happens When the Iterables are of Different Lengths?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you go back to the documentation, the second item in the numbered list reads:\u00a0&#8220;The iterator stops when the shortest input iterable is exhausted.&#8221;<\/p>\n<p>Unlike working with the\u00a0<code>range()<\/code>\u00a0object, using\u00a0<code>zip()<\/code>\u00a0doesn&#8217;t throw errors when all iterables are of potentially different lengths. Let&#8217;s verify this as shown below.<\/p>\n<p>Let&#8217;s remove\u00a0<code>'e'<\/code>\u00a0from\u00a0<code>L2<\/code>, and repeat the steps above.<\/p>\n<pre class=\" language-python\"><code class=\" language-python\">L1 = [1,2,3,4,5]\r\nL2 = ['a','b','c','d']\r\n\r\nzip_L1L2 = zip(L1,L2)\r\n\r\nprint(list(zip_L1L2))\r\n\r\n# Output\r\n[(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd')]<\/code><\/pre>\n<p>We now see that the output list only contains 4 tuples and the item\u00a0<code>5<\/code>\u00a0from\u00a0<code>L1<\/code> has not been used.<\/p>\n<h4 style=\"text-align: center;\"><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;\\&quot;Ready to take your python skills to the next level? Sign up for a free demo today!\\&quot;&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:1061443,&quot;3&quot;:{&quot;1&quot;:0},&quot;4&quot;:{&quot;1&quot;:2,&quot;2&quot;:16316664},&quot;9&quot;:0,&quot;12&quot;:0,&quot;15&quot;:&quot;Arial&quot;,&quot;16&quot;:10,&quot;23&quot;:1}\" data-sheets-hyperlink=\"https:\/\/entri.app\/course\/python-programming-course\/\"><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/course\/python-programming-course\/\" target=\"_blank\" rel=\"noopener\">&#8220;Ready to take your python skills to the next level? Sign up for a free demo today!&#8221;<\/a><\/span><\/h4>\n<h2 id=\"what-happens-when-you-pass-in-one-or-no-iterable-to-the-zip-function\"><span class=\"ez-toc-section\" id=\"What_Happens_When_You_Pass_in_One_or_No_Iterable_to_the_zip_Function\"><\/span><strong>What Happens When You Pass in One or No Iterable to the zip() Function?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Let&#8217;s revisit the items 3 and 4 of the documentation again.<\/p>\n<blockquote><p>&#8220;With a single iterable argument, it returns an iterator of 1-tuples.<br \/>\nWith no arguments, it returns an empty iterator.&#8221;<\/p><\/blockquote>\n<p>Let&#8217;s go ahead and verify this. Observe how we get 1-tuples when we pass in only\u00a0<code>L1<\/code>\u00a0in the code snippet below:<\/p>\n<pre class=\" language-python\"><code class=\" language-python\">L1 = [1,2,3,4,5]\r\nzip_L1 = zip(L1)\r\nprint(list(zip_L1))\r\n\r\n# Output\r\n[(1,), (2,), (3,), (4,), (5,)]\r\n<\/code><\/pre>\n<p>When we call the\u00a0<code>zip()<\/code>\u00a0function with no arguments, we get an empty list, as shown below:<\/p>\n<pre class=\" language-python\"><code class=\" language-python\">zip_None = zip()\r\nprint(list(zip_None))\r\n\r\n# Output\r\n[]<\/code><\/pre>\n<p>Let&#8217;s now create a more intuitive example. The code snippet below shows how we can use\u00a0<code>zip()<\/code> in Python to zip together 3 lists and perform meaningful operations.<\/p>\n<p>Given a list of fruits, their prices and the quantities that you purchased, the total amount spent on each item is printed out.<\/p>\n<pre class=\" language-python\"><code class=\" language-python\">fruits = [\"apples\",\"oranges\",\"bananas\",\"melons\"]\r\nprices = [20,10,5,15]\r\nquantities = [5,7,3,4]\r\n\r\nfor fruit, price, quantity in zip(fruits,prices,quantities):\r\n  print(f\"You bought {quantity} {fruit} for ${price*quantity}\")\r\n  \r\n# Output\r\nYou bought 5 apples for $100\r\nYou bought 7 oranges for $70\r\nYou bought 3 bananas for $15\r\nYou bought 4 melons for $60\r\n  <\/code><\/pre>\n<p>Now we understand how the\u00a0<code>zip()<\/code> in Python function works, and we know its limitation that the iterator stops when the shortest iterable is exhausted. Now, let&#8217;s see how we can overcome this limitation using the <code>zip_longest()<\/code>\u00a0function in Python.<\/p>\n<h2 id=\"how-to-use-the-zip_longest-function-in-python\"><span class=\"ez-toc-section\" id=\"How_to_Use_the_zip_longest_Function_in_Python\"><\/span><strong>How to Use the zip_longest() Function in Python<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Let&#8217;s import the\u00a0<code>zip_longest()<\/code>\u00a0function from the\u00a0<code>itertools<\/code>\u00a0module:<\/p>\n<pre><code>from itertools import zip_longest<\/code><\/pre>\n<p>Let&#8217;s now try out an earlier example of\u00a0<code>L2<\/code>\u00a0containing one item less than\u00a0<code>L1<\/code>.<\/p>\n<pre class=\" language-python\"><code class=\" language-python\">L1 = [1,2,3,4,5]\r\nL2 = ['a','b','c','d']\r\n\r\nzipL_L1L2 = zip_longest(L1,L2)\r\n\r\nprint(list(zipL_L1L2))\r\n\r\n# Output\r\n[(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, None)]<\/code><\/pre>\n<p>Notice how the item\u00a0<code>5<\/code>\u00a0from\u00a0<code>L1<\/code>\u00a0is still included. But as there&#8217;s no matching item in\u00a0<code>L2<\/code>, the second element in the last tuple is\u00a0<code>None<\/code>.<\/p>\n<p><a href=\"https:\/\/entri.app\/course\/python-programming-course\/\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-25520910 size-full\" src=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square.png\" alt=\"Python and Machine Learning Square\" width=\"345\" height=\"345\" srcset=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square.png 345w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-300x300.png 300w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-150x150.png 150w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-24x24.png 24w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-48x48.png 48w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-96x96.png 96w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Square-75x75.png 75w\" sizes=\"auto, (max-width: 345px) 100vw, 345px\" \/><\/a><\/p>\n<p>You can customize it more if you want to. For example, you can replace\u00a0<code>None<\/code>\u00a0with a more indicative term such as\u00a0<code>Empty<\/code>,\u00a0<code>Item Not Found<\/code>, and so on. All you have to do is set the optional\u00a0<code>fillvalue<\/code>\u00a0argument to the term that you wish to display when there&#8217;s no matching item in an iterable when you call\u00a0<code>zip_longest()<\/code>.<\/p>\n<p>I hope you now understand zip function in Python and <code>zip_longest()<\/code>\u00a0functions.<\/p>\n<h4><strong>Related Articles<\/strong><\/h4>\n<div class=\"table-responsive wprt_style_display\">\n<div class=\"table-responsive wprt_style_display\">\n<div class=\"table-responsive wprt_style_display\">\n<div class=\"table-responsive wprt_style_display\">\n<div class=\"table-responsive wprt_style_display\">\n<table class=\"table\" dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col width=\"329\" \/>\n<col width=\"309\" \/><\/colgroup>\n<tbody>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Syllabus&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-village-field-assistant-vfa-syllabus-exam-pattern\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/data-visualization-in-python\/\" target=\"_blank\" rel=\"noopener\">Introduction to Data Visualization in Python<\/a><\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Mock Test&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-free-mock-test\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/why-python-is-used-for-data-science\/\" target=\"_blank\" rel=\"noopener\">Why Python Is Used For Data Science?<\/a><\/strong><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Exam Date&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-exam-date\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/step-by-step-guide-for-getting-a-job-as-a-python-developer\/\" target=\"_blank\" rel=\"noopener\">Guide for getting a job as a Python Developer<\/a><\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Video Course&quot;}\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/top-python-interview-questions-and-answers\/\" target=\"_blank\" rel=\"noopener\">Python Advanced Interview Questions and Answers<\/a><\/strong><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Application Form&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-apply-online\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/python-online-course\/\" target=\"_blank\" rel=\"noopener\">Best Online Python Course with Certificate<\/a><\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Study Materials&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-study-material\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/type-conversion-in-python\/\" target=\"_blank\" rel=\"noopener\">What is Type Conversion in Python?<\/a><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n<\/div>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever needed to loop through multiple iterables in parallel when coding in Python?In this blog, we will use Python&#8217;s zip() function to efficiently perform parallel iteration over multiple iterables. Python zip() Function \u2013 Explained with Code Examples How to Use the &#8216;in&#8217; Operator in Python to Traverse Iterables Before we go ahead and [&hellip;]<\/p>\n","protected":false},"author":111,"featured_media":25531561,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[802,1888],"tags":[],"class_list":["post-25531320","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","category-python-programming"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Learn Zip Function In Python With Examples - Entri Blog<\/title>\n<meta name=\"description\" content=\"In this blog, we will use Python&#039;s zip() function to efficiently perform parallel iteration over multiple iterables.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Learn Zip Function In Python With Examples - Entri Blog\" \/>\n<meta property=\"og:description\" content=\"In this blog, we will use Python&#039;s zip() function to efficiently perform parallel iteration over multiple iterables.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"Entri Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/entri.me\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-02T17:06:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-28T06:17:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png\" \/>\n\t<meta property=\"og:image:width\" content=\"820\" \/>\n\t<meta property=\"og:image:height\" content=\"615\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Feeba Mahin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@entri_app\" \/>\n<meta name=\"twitter:site\" content=\"@entri_app\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Feeba Mahin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/\"},\"author\":{\"name\":\"Feeba Mahin\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36\"},\"headline\":\"Learn Zip Function In Python With Examples\",\"datePublished\":\"2022-07-02T17:06:40+00:00\",\"dateModified\":\"2023-04-28T06:17:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/\"},\"wordCount\":1173,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png\",\"articleSection\":[\"Articles\",\"Python Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/\",\"url\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/\",\"name\":\"Learn Zip Function In Python With Examples - Entri Blog\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png\",\"datePublished\":\"2022-07-02T17:06:40+00:00\",\"dateModified\":\"2023-04-28T06:17:46+00:00\",\"description\":\"In this blog, we will use Python's zip() function to efficiently perform parallel iteration over multiple iterables.\",\"breadcrumb\":{\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#primaryimage\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png\",\"width\":820,\"height\":615,\"caption\":\"Learn Zip Function In Python With Examples\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/entri.app\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Programming\",\"item\":\"https:\/\/entri.app\/blog\/category\/python-programming\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Learn Zip Function In Python With Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/entri.app\/blog\/#website\",\"url\":\"https:\/\/entri.app\/blog\/\",\"name\":\"Entri Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/entri.app\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/entri.app\/blog\/#organization\",\"name\":\"Entri App\",\"url\":\"https:\/\/entri.app\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"width\":989,\"height\":446,\"caption\":\"Entri App\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/entri.me\/\",\"https:\/\/x.com\/entri_app\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36\",\"name\":\"Feeba Mahin\",\"url\":\"https:\/\/entri.app\/blog\/author\/feeba123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Learn Zip Function In Python With Examples - Entri Blog","description":"In this blog, we will use Python's zip() function to efficiently perform parallel iteration over multiple iterables.","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:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/","og_locale":"en_US","og_type":"article","og_title":"Learn Zip Function In Python With Examples - Entri Blog","og_description":"In this blog, we will use Python's zip() function to efficiently perform parallel iteration over multiple iterables.","og_url":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/","og_site_name":"Entri Blog","article_publisher":"https:\/\/www.facebook.com\/entri.me\/","article_published_time":"2022-07-02T17:06:40+00:00","article_modified_time":"2023-04-28T06:17:46+00:00","og_image":[{"width":820,"height":615,"url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png","type":"image\/png"}],"author":"Feeba Mahin","twitter_card":"summary_large_image","twitter_creator":"@entri_app","twitter_site":"@entri_app","twitter_misc":{"Written by":"Feeba Mahin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#article","isPartOf":{"@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/"},"author":{"name":"Feeba Mahin","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36"},"headline":"Learn Zip Function In Python With Examples","datePublished":"2022-07-02T17:06:40+00:00","dateModified":"2023-04-28T06:17:46+00:00","mainEntityOfPage":{"@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/"},"wordCount":1173,"commentCount":0,"publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"image":{"@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png","articleSection":["Articles","Python Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/","url":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/","name":"Learn Zip Function In Python With Examples - Entri Blog","isPartOf":{"@id":"https:\/\/entri.app\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#primaryimage"},"image":{"@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png","datePublished":"2022-07-02T17:06:40+00:00","dateModified":"2023-04-28T06:17:46+00:00","description":"In this blog, we will use Python's zip() function to efficiently perform parallel iteration over multiple iterables.","breadcrumb":{"@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#primaryimage","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/07\/Learn-Zip-Function-In-Python-With-Examples.png","width":820,"height":615,"caption":"Learn Zip Function In Python With Examples"},{"@type":"BreadcrumbList","@id":"https:\/\/entri.app\/blog\/learn-zip-function-in-python-with-examples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/entri.app\/blog\/"},{"@type":"ListItem","position":2,"name":"Python Programming","item":"https:\/\/entri.app\/blog\/category\/python-programming\/"},{"@type":"ListItem","position":3,"name":"Learn Zip Function In Python With Examples"}]},{"@type":"WebSite","@id":"https:\/\/entri.app\/blog\/#website","url":"https:\/\/entri.app\/blog\/","name":"Entri Blog","description":"","publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/entri.app\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/entri.app\/blog\/#organization","name":"Entri App","url":"https:\/\/entri.app\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","width":989,"height":446,"caption":"Entri App"},"image":{"@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/entri.me\/","https:\/\/x.com\/entri_app"]},{"@type":"Person","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/f036dab84abae3dcc9390a1110d95d36","name":"Feeba Mahin","url":"https:\/\/entri.app\/blog\/author\/feeba123\/"}]}},"_links":{"self":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25531320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/users\/111"}],"replies":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/comments?post=25531320"}],"version-history":[{"count":9,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25531320\/revisions"}],"predecessor-version":[{"id":25559372,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25531320\/revisions\/25559372"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media\/25531561"}],"wp:attachment":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media?parent=25531320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/categories?post=25531320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/tags?post=25531320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}