{"id":4701,"date":"2022-09-11T06:47:41","date_gmt":"2022-09-11T06:47:41","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=4701"},"modified":"2022-09-11T07:50:13","modified_gmt":"2022-09-11T07:50:13","slug":"python-zip","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/python-built-in-functions\/python-zip\/","title":{"rendered":"Python zip"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to use the Python <code>zip()<\/code> function to perform parallel iterations on multiple iterables.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-the-python-zip-function'>Introduction to the Python zip() function <a href=\"#introduction-to-the-python-zip-function\" class=\"anchor\" id=\"introduction-to-the-python-zip-function\" title=\"Anchor for Introduction to the Python zip() function\">#<\/a><\/h2>\n\n\n\n<p>Suppose you have two <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-tuples\/\">tuples<\/a>: <code>names<\/code> and <code>ages<\/code>.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The <code>names<\/code> tuple stores a list of names.<\/li><li>The <code>age<\/code>s tuple stores a list of ages.<\/li><\/ul>\n\n\n\n<p>To map names and ages from these tuples one-by-one in sequence, you may use the <a href=\"https:\/\/www.pythontutorial.net\/python-built-in-functions\/python-enumerate\/\"><code>enumerate()<\/code><\/a> function. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">names = (<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-string\">'Alice'<\/span>)\nages = (<span class=\"hljs-number\">20<\/span>, <span class=\"hljs-number\">22<\/span>, <span class=\"hljs-number\">25<\/span>)\n\n<span class=\"hljs-keyword\">for<\/span> index, name <span class=\"hljs-keyword\">in<\/span> enumerate(names):\n    print((name, ages&#91;index]))<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">(<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-number\">20<\/span>)\n(<span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-number\">22<\/span>)\n(<span class=\"hljs-string\">'Alice'<\/span>, <span class=\"hljs-number\">25<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>So John is 20, Jane is 22, and Alice is 25<\/p>\n\n\n\n<p>However, It&#8217;s getting more complicated if the sizes of the <code>names<\/code> and <code>ages<\/code> tuples are different. That&#8217;s why the <code>zip()<\/code> function comes to play.<\/p>\n\n\n\n<p>The following shows the syntax of the <code>zip()<\/code> function:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">zip(*iterables, strict=<span class=\"hljs-literal\">False<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>zip()<\/code> function iterates multiple iterables <em>in parallel<\/em> and returns the <em>tuples <\/em>that contain elements from each iterable.<\/p>\n\n\n\n<p>In other words, the <code>zip()<\/code> function returns an <a href=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-iterators\/\">iterator<\/a> of tuples where i-th tuple contains the i-th element from each input iterable.<\/p>\n\n\n\n<p>The following example shows how to use the <code>zip()<\/code> function to iterate over the <code>names<\/code> and <code>ages<\/code> tuples:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">names = (<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-string\">'Alice'<\/span>)\nages = (<span class=\"hljs-number\">20<\/span>, <span class=\"hljs-number\">22<\/span>, <span class=\"hljs-number\">25<\/span>)\n\n<span class=\"hljs-keyword\">for<\/span> employee <span class=\"hljs-keyword\">in<\/span> zip(names, ages):\n    print(employee)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">(<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-number\">20<\/span>)\n(<span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-number\">22<\/span>)\n(<span class=\"hljs-string\">'Alice'<\/span>, <span class=\"hljs-number\">25<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, the <code>zip()<\/code> returns a tuple in each iteration and assigns it to the <code>employee<\/code> variable. The tuple contains the i-th elements the <code>names<\/code> and <code>ages<\/code> tuples.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"604\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/Python-zip.png\" alt=\"Python zip\" class=\"wp-image-4708\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/Python-zip.png 708w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/09\/Python-zip-300x256.png 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p>The <code>zip()<\/code> function returns a zip object which is an iterator:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">names = (<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-string\">'Alice'<\/span>)\nages = (<span class=\"hljs-number\">20<\/span>, <span class=\"hljs-number\">22<\/span>, <span class=\"hljs-number\">25<\/span>)\n\nemployees = zip(names, ages)\n\nprint(type(employees))  <span class=\"hljs-comment\"># ? &lt;class 'zip'&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>zip()<\/code> is lazy. It means that Python won&#8217;t process the elements until you iterate the iterable. To iterate the iterable, you can use:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Using a <code>for<\/code> loop<\/li><li>Calling the <code>next()<\/code> function<\/li><li>Wrapping in a <code><a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-list\/\"><code>list()<\/code><\/a><\/code><\/li><\/ul>\n\n\n\n<p>For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">names = (<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-string\">'Alice'<\/span>)\nages = (<span class=\"hljs-number\">20<\/span>, <span class=\"hljs-number\">22<\/span>, <span class=\"hljs-number\">25<\/span>)\n\nemployees = zip(names, ages)\nemployee_list = list(employees)\n\nprint(employee_list)  <span class=\"hljs-comment\"># ? &#91;('John', 20), ('Jane', 22), ('Alice', 25)]<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='iterables-with-different-sizes'>Iterables with different sizes <a href=\"#iterables-with-different-sizes\" class=\"anchor\" id=\"iterables-with-different-sizes\" title=\"Anchor for Iterables with different sizes\">#<\/a><\/h2>\n\n\n\n<p>The iterables passed to the <code><code>zip()<\/code><\/code> function may have different sizes. The <code><code>zip()<\/code><\/code> has three different strategies to deal with this issue.<\/p>\n\n\n\n<p>By default, the <code>zip()<\/code> will stop when it completes iterating the shortest iterable. It&#8217;ll ignore the remaining items in the longer iterables. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">names = (<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-string\">'Alice'<\/span>, <span class=\"hljs-string\">'Peter'<\/span>)\nages = (<span class=\"hljs-number\">20<\/span>, <span class=\"hljs-number\">22<\/span>, <span class=\"hljs-number\">25<\/span>)\n\n<span class=\"hljs-keyword\">for<\/span> name, age <span class=\"hljs-keyword\">in<\/span> zip(names, ages):\n    print(name, age)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">John <span class=\"hljs-number\">20<\/span>\nJane <span class=\"hljs-number\">22<\/span>\nAlice <span class=\"hljs-number\">25<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, the <code>zip()<\/code> function performs three iterations based on the shortest size of the names and ages.<\/p>\n\n\n\n<p>If you want to ensure that the iterables must have the same sizes, you can use the <code>strict=True<\/code> option. In this case, if the sizes of the iterables are different, the <code>zip()<\/code> will raise a <code>ValueError<\/code>. <\/p>\n\n\n\n<p class=\"note\">Note that the <code>strict<\/code> argument has been available since Python 3.10<\/p>\n\n\n\n<p>For example, the following will raise a <code>ValueError<\/code> exception because the sizes of the iterables are different:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">names = (<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-string\">'Alice'<\/span>, <span class=\"hljs-string\">'Peter'<\/span>)\nages = (<span class=\"hljs-number\">20<\/span>, <span class=\"hljs-number\">22<\/span>, <span class=\"hljs-number\">25<\/span>)\n\n<span class=\"hljs-keyword\">for<\/span> name, age <span class=\"hljs-keyword\">in<\/span> zip(names, ages, strict=<span class=\"hljs-literal\">True<\/span>):  <span class=\"hljs-comment\"># ValueError ?<\/span>\n    print(name, age)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">ValueError: zip() argument <span class=\"hljs-number\">2<\/span> <span class=\"hljs-keyword\">is<\/span> shorter than argument <span class=\"hljs-number\">1<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If the iterables are of uneven size, and you want to fill missing values with a <code>fillvalue<\/code>, you can use the <code>zip_longest()<\/code> function from the <code>itertools<\/code> module:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">itertools.zip_longest(*iterables, fillvalue=<span class=\"hljs-literal\">None<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>By default, the <code>fillvalue<\/code> is None. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">from<\/span> itertools <span class=\"hljs-keyword\">import<\/span> zip_longest\n\nnames = (<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-string\">'Alice'<\/span>, <span class=\"hljs-string\">'Peter'<\/span>)\nages = (<span class=\"hljs-number\">20<\/span>, <span class=\"hljs-number\">22<\/span>, <span class=\"hljs-number\">25<\/span>)\n\n<span class=\"hljs-keyword\">for<\/span> name, age <span class=\"hljs-keyword\">in<\/span> zip_longest(names, ages):\n    print(name, age)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">John <span class=\"hljs-number\">20<\/span>\nJane <span class=\"hljs-number\">22<\/span>\nAlice <span class=\"hljs-number\">25<\/span>\nPeter <span class=\"hljs-literal\">None<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='unzip-an-iterable-using-the-python-zip-function'>Unzip an iterable using the Python zip() function <a href=\"#unzip-an-iterable-using-the-python-zip-function\" class=\"anchor\" id=\"unzip-an-iterable-using-the-python-zip-function\" title=\"Anchor for Unzip an iterable using the Python zip() function\">#<\/a><\/h2>\n\n\n\n<p>Unzipping reverses the zipping by converting the zipped values back to individual values. To unzip, you use the zip() function with the <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-unpacking-tuple\/\">unpacking operator<\/a> (<code>*<\/code>). For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">employees = ((<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-number\">20<\/span>), (<span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-number\">22<\/span>), (<span class=\"hljs-string\">'Alice'<\/span>, <span class=\"hljs-number\">25<\/span>))\nnames, ages = zip(*employees)\n\nprint(names)\nprint(ages)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-16\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">(<span class=\"hljs-string\">'John'<\/span>, <span class=\"hljs-string\">'Jane'<\/span>, <span class=\"hljs-string\">'Alice'<\/span>) \n(<span class=\"hljs-number\">20<\/span>, <span class=\"hljs-number\">22<\/span>, <span class=\"hljs-number\">25<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-16\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, we have a tuple where each element contains a name and age. The <code>zip()<\/code> function unpacks the tuple to create two different tuples (names and ages).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Use the <code>zip()<\/code> function to iterate iterables in parallel.<\/li><li>Use the <code>zip()<\/code> function with the unpacking operator (<code>*<\/code>) to unzip values.<\/li><li>Use <code>itertool.zip_longest()<\/code> function to zip iterables of different sizes.<\/li><\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"4701\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-built-in-functions\/python-zip\/\"\n\t\t\t\tdata-post-title=\"Python zip\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"4701\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-built-in-functions\/python-zip\/\"\n\t\t\t\tdata-post-title=\"Python zip\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to use the Python zip() function to perform parallel iterations on multiple iterables.<\/p>\n","protected":false},"author":1,"featured_media":4708,"parent":1055,"menu_order":9,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-4701","page","type-page","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/4701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=4701"}],"version-history":[{"count":0,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/4701\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/1055"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media\/4708"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=4701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}