{"id":4152,"date":"2022-07-19T01:28:00","date_gmt":"2022-07-19T01:28:00","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=4152"},"modified":"2025-04-02T06:44:59","modified_gmt":"2025-04-02T06:44:59","slug":"python-asyncio-gather","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/python-concurrency\/python-asyncio-gather\/","title":{"rendered":"Python asyncio.gather()"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to use the Python <code>asyncio.gather()<\/code> function to run multiple asynchronous operations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-the-python-asyncio-gather-function'>Introduction to the Python asyncio.gather() function <a href=\"#introduction-to-the-python-asyncio-gather-function\" class=\"anchor\" id=\"introduction-to-the-python-asyncio-gather-function\" title=\"Anchor for Introduction to the Python asyncio.gather() function\">#<\/a><\/h2>\n\n\n\n<p>Sometimes, you may want to run multiple asynchronous operations and get the results once they are complete. To do that you can use the <code>asyncio.gather()<\/code> function:<\/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\">gather(*aws, return_exceptions=<span class=\"hljs-literal\">False<\/span>) -&gt; Future&#91;tuple&#91;()]]<\/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>The <code>asyncio.gather()<\/code> function has two parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>aws<\/code> is a sequence of awaitable objects. If any object in the <code>aws<\/code> is a <a href=\"https:\/\/www.pythontutorial.net\/python-concurrency\/python-async-await\/\">coroutine<\/a>, the <code>asyncio.gather()<\/code> function will automatically schedule it as a <a href=\"https:\/\/www.pythontutorial.net\/python-concurrency\/python-asyncio-create_task\/\">task<\/a>. <\/li>\n\n\n\n<li><code>return_exceptions<\/code> is <code>False<\/code> by default. If an exception occurs in an awaitable object, it is immediately propagated to the task that awaits on <code>asyncio.gather()<\/code>. Other awaitables will continue to run and <strong>won&#8217;t be canceled<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p>The <code>asyncio.gather()<\/code> returns the results of awaitables as a tuple <strong>with the same order<\/strong> as you pass the awaitables to the function.<\/p>\n\n\n\n<p>If the <code>return_exceptions<\/code> is <code>True<\/code>. The <code>asyncio.gather()<\/code> will add the <a href=\"https:\/\/www.pythontutorial.net\/python-oop\/python-exceptions\/\">exception<\/a> if any to the result and not propagate the exception to the caller.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='python-asyncio-gather-examples'>Python asyncio.gather() examples <a href=\"#python-asyncio-gather-examples\" class=\"anchor\" id=\"python-asyncio-gather-examples\" title=\"Anchor for Python asyncio.gather() examples\">#<\/a><\/h2>\n\n\n\n<p>Let&#8217;s take some examples of using the <code>asyncio.gather()<\/code> function.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='using-asyncio-gather-to-run-multiple-asynchronous-operations'>Using asyncio.gather() to run multiple asynchronous operations <a href=\"#using-asyncio-gather-to-run-multiple-asynchronous-operations\" class=\"anchor\" id=\"using-asyncio-gather-to-run-multiple-asynchronous-operations\" title=\"Anchor for Using asyncio.gather() to run multiple asynchronous operations\">#<\/a><\/h3>\n\n\n\n<p>The following example uses the <code>asyncio.gather()<\/code> to run two asynchronous operations and displays the results:<\/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-keyword\">import<\/span> asyncio\n\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">call_api<\/span><span class=\"hljs-params\">(message, result, delay=<span class=\"hljs-number\">3<\/span>)<\/span>:<\/span>\n    print(message)\n    <span class=\"hljs-keyword\">await<\/span> asyncio.sleep(delay)\n    <span class=\"hljs-keyword\">return<\/span> result\n\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">main<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    a, b = <span class=\"hljs-keyword\">await<\/span> asyncio.gather(\n        call_api(<span class=\"hljs-string\">'Calling API 1 ...'<\/span>, <span class=\"hljs-number\">100<\/span>),\n        call_api(<span class=\"hljs-string\">'Calling API 2 ...'<\/span>, <span class=\"hljs-number\">200<\/span>)\n    )\n    print(a, b)\n\n\nasyncio.run(main())<\/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>Output:<\/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\">Calling API <span class=\"hljs-number\">1<\/span> ...\nCalling API <span class=\"hljs-number\">2<\/span> ...\n<span class=\"hljs-number\">100<\/span> <span class=\"hljs-number\">200<\/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>How it works.<\/p>\n\n\n\n<p>First, define a coroutine <code><code>call_api()<\/code><\/code> that simulates an asynchronous operation. The <code>call_api()<\/code> displays a message, delays a number of seconds, and returns a result:<\/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\"><span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">call_api<\/span><span class=\"hljs-params\">(message, result, delay=<span class=\"hljs-number\">3<\/span>)<\/span>:<\/span>\n    print(message)\n    <span class=\"hljs-keyword\">await<\/span> asyncio.sleep(delay)\n    <span class=\"hljs-keyword\">return<\/span> result<\/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>Second, use the <code>asyncio.gather()<\/code> function to run two <code>call_api()<\/code>:<\/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-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">main<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    a, b = <span class=\"hljs-keyword\">await<\/span> asyncio.gather(\n        call_api(<span class=\"hljs-string\">'Calling API 1 ...'<\/span>, <span class=\"hljs-number\">100<\/span>, <span class=\"hljs-number\">1<\/span>),\n        call_api(<span class=\"hljs-string\">'Calling API 2 ...'<\/span>, <span class=\"hljs-number\">200<\/span>, <span class=\"hljs-number\">2<\/span>)\n    )\n    print(a, b)<\/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>The first coroutine takes 1 second and returns 100 while the second coroutine takes 2 seconds and returns 100.<\/p>\n\n\n\n<p>After 2 seconds, the gather returns the result as a tuple that contains the result of the first and second coroutines.<\/p>\n\n\n\n<p>Note that a is 100 and b is 200 which are the results of the corresponding coroutine that we pass to the <code>asyncio.gather()<\/code> function.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='using-asyncio-gather-to-run-multiple-asynchronous-operations-with-exceptions'>Using asyncio.gather() to run multiple asynchronous operations with exceptions <a href=\"#using-asyncio-gather-to-run-multiple-asynchronous-operations-with-exceptions\" class=\"anchor\" id=\"using-asyncio-gather-to-run-multiple-asynchronous-operations-with-exceptions\" title=\"Anchor for Using asyncio.gather() to run multiple asynchronous operations with exceptions\">#<\/a><\/h3>\n\n\n\n<p>The following example shows how to use the <code>asyncio.gather()<\/code> function to execute multiple asynchronous operations where an operation raises an exception:<\/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\"><span class=\"hljs-keyword\">import<\/span> asyncio\n\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">APIError<\/span><span class=\"hljs-params\">(Exception)<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self, message)<\/span>:<\/span>\n        self._message = message\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__str__<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n        <span class=\"hljs-keyword\">return<\/span> self._message\n\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">call_api_failed<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    <span class=\"hljs-keyword\">await<\/span> asyncio.sleep(<span class=\"hljs-number\">3<\/span>)\n    <span class=\"hljs-keyword\">raise<\/span> APIError(<span class=\"hljs-string\">'API failed'<\/span>)\n\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">call_api<\/span><span class=\"hljs-params\">(message, result, delay=<span class=\"hljs-number\">3<\/span>)<\/span>:<\/span>\n    print(message)\n    <span class=\"hljs-keyword\">await<\/span> asyncio.sleep(delay)\n    <span class=\"hljs-keyword\">return<\/span> result\n\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">main<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    a, b, c = <span class=\"hljs-keyword\">await<\/span> asyncio.gather(\n        call_api(<span class=\"hljs-string\">'Calling API 1 ...'<\/span>, <span class=\"hljs-number\">100<\/span>, <span class=\"hljs-number\">1<\/span>),\n        call_api(<span class=\"hljs-string\">'Calling API 2 ...'<\/span>, <span class=\"hljs-number\">200<\/span>, <span class=\"hljs-number\">2<\/span>),\n        call_api_failed()\n    )\n    print(a, b, c)\n\n\nasyncio.run(main())<\/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>How it works.<\/p>\n\n\n\n<p>First, define a new <code>APIError<\/code> exception class that inherits from the <code>Exception<\/code> class:<\/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\"><span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">APIError<\/span><span class=\"hljs-params\">(Exception)<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self, message)<\/span>:<\/span>\n        self._message = message\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__str__<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n        <span class=\"hljs-keyword\">return<\/span> self._message<\/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<p>Second, define the <code>call_api_failed()<\/code> coroutine that delays 1 second and raises an <code>APIError<\/code> exception:<\/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\"><span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">call_api_failed<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    <span class=\"hljs-keyword\">await<\/span> asyncio.sleep(<span class=\"hljs-number\">3<\/span>)\n    <span class=\"hljs-keyword\">raise<\/span> APIError(<span class=\"hljs-string\">'API failed'<\/span>)<\/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>Third, pass three coroutines to the <code>asyncio.gather()<\/code> function. After one second, the <code>call_api_failed()<\/code> raises an exception that immediately propagates to the <code>asyncio.gather()<\/code> function:<\/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\"><span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">main<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    a, b, c = <span class=\"hljs-keyword\">await<\/span> asyncio.gather(\n        call_api(<span class=\"hljs-string\">'Calling API 1 ...'<\/span>, <span class=\"hljs-number\">100<\/span>, <span class=\"hljs-number\">1<\/span>),\n        call_api(<span class=\"hljs-string\">'Calling API 2 ...'<\/span>, <span class=\"hljs-number\">200<\/span>, <span class=\"hljs-number\">2<\/span>),\n        call_api_failed()\n    )\n    print(a, b, c)<\/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>If you run the program, you&#8217;ll see the <code>APIError<\/code> exception.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='using-asyncio-gather-to-return-an-exception-in-the-result'>Using asyncio.gather() to return an exception in the result <a href=\"#using-asyncio-gather-to-return-an-exception-in-the-result\" class=\"anchor\" id=\"using-asyncio-gather-to-return-an-exception-in-the-result\" title=\"Anchor for Using asyncio.gather() to return an exception in the result\">#<\/a><\/h3>\n\n\n\n<p>To get the exception in the result, you set the <code>return_exceptions<\/code> parameter to <code>True<\/code> as follows:<\/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\"><span class=\"hljs-keyword\">import<\/span> asyncio\n\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">APIError<\/span><span class=\"hljs-params\">(Exception)<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self, message)<\/span>:<\/span>\n        self._message = message\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__str__<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n        <span class=\"hljs-keyword\">return<\/span> self._message\n\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">call_api<\/span><span class=\"hljs-params\">(message, result, delay=<span class=\"hljs-number\">3<\/span>)<\/span>:<\/span>\n    print(message)\n    <span class=\"hljs-keyword\">await<\/span> asyncio.sleep(delay)\n    <span class=\"hljs-keyword\">return<\/span> result\n\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">call_api_failed<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    <span class=\"hljs-keyword\">await<\/span> asyncio.sleep(<span class=\"hljs-number\">1<\/span>)\n    <span class=\"hljs-keyword\">raise<\/span> APIError(<span class=\"hljs-string\">'API failed'<\/span>)\n\n\n<span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">main<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    a, b, c = <span class=\"hljs-keyword\">await<\/span> asyncio.gather(\n        call_api(<span class=\"hljs-string\">'Calling API 1 ...'<\/span>, <span class=\"hljs-number\">100<\/span>, <span class=\"hljs-number\">1<\/span>),\n        call_api(<span class=\"hljs-string\">'Calling API 2 ...'<\/span>, <span class=\"hljs-number\">200<\/span>, <span class=\"hljs-number\">2<\/span>),\n        call_api_failed(),\n        return_exceptions=<span class=\"hljs-literal\">True<\/span>\n    )\n    print(a, b, c)\n\n\nasyncio.run(main())<\/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\">Calling API <span class=\"hljs-number\">1<\/span> ...\nCalling API <span class=\"hljs-number\">2<\/span> ...\n<span class=\"hljs-number\">100<\/span> <span class=\"hljs-number\">200<\/span> API failed<\/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>In this example, because the <code>return_exceptions<\/code> is set to <code>True<\/code>, the <code>asyncio.gather()<\/code> returns the exception as part of the result.<\/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\">\n<li>The <code>asyncio.gather()<\/code> runs multiple asynchronous operations, wraps a coroutine as a task, and returns a tuple of results in the same order of awaitables. <\/li>\n\n\n\n<li>Set <code>return_exceptions<\/code> to <code>True<\/code> to allow errors to be returned as results.<\/li>\n<\/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=\"4152\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-concurrency\/python-asyncio-gather\/\"\n\t\t\t\tdata-post-title=\"Python asyncio.gather()\"\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=\"4152\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-concurrency\/python-asyncio-gather\/\"\n\t\t\t\tdata-post-title=\"Python asyncio.gather()\"\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 asyncio.gather() function to run multiple asynchronous operations.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":4104,"menu_order":21,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-4152","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/4152","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=4152"}],"version-history":[{"count":1,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/4152\/revisions"}],"predecessor-version":[{"id":7369,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/4152\/revisions\/7369"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/4104"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=4152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}