{"id":955,"date":"2020-11-05T03:07:39","date_gmt":"2020-11-05T03:07:39","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=955"},"modified":"2025-03-27T13:42:22","modified_gmt":"2025-03-27T13:42:22","slug":"python-nonlocal","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/advanced-python\/python-nonlocal\/","title":{"rendered":"Python nonlocal"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn about the Python nonlocal scopes and how to use the <code>nonlocal<\/code> keyword to change the variables of the nonlocal scopes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-python-nonlocal-scopes'>Introduction to Python nonlocal scopes <a href=\"#introduction-to-python-nonlocal-scopes\" class=\"anchor\" id=\"introduction-to-python-nonlocal-scopes\" title=\"Anchor for Introduction to Python nonlocal scopes\">#<\/a><\/h2>\n\n\n\n<p>In Python, you can <a href=\"https:\/\/www.pythontutorial.net\/python-basics\/python-functions\/\">define a function<\/a> inside another 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\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">outer<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    print(<span class=\"hljs-string\">'outer function'<\/span>)\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">inner<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n        print(<span class=\"hljs-string\">'inner function'<\/span>)\n\n    inner()\n\n\nouter()<\/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><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=ZGVmIG91dGVyKCk6CiAgICBwcmludCgnb3V0ZXIgZnVuY3Rpb24nKQoKICAgIGRlZiBpbm5lcigpOgogICAgICAgIHByaW50KCdpbm5lciBmdW5jdGlvbicpCgogICAgaW5uZXIoKQoKCm91dGVyKCk%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">outer function\ninner function<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, we defined a function called <code>outer<\/code>.<\/p>\n\n\n\n<p>Inside the <code>outer<\/code> function, we defined another function called <code>inner<\/code>. And we called the <code>inner<\/code> function from the inside of the <code>outer<\/code> function.<\/p>\n\n\n\n<p>Often, we say that the <code>inner<\/code> function is nested in the <code>outer<\/code> function. In practice, you define nested functions when you don&#8217;t want these functions to be global.<\/p>\n\n\n\n<p>Both <code>outer<\/code> and <code>inner<\/code> have access to the <a href=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-variable-scopes\/\">global and built-in scopes<\/a> as well as their local scopes.<\/p>\n\n\n\n<p>And the <code>inner<\/code> function also has access to its enclosing scope, which is the scope of the <code>outer<\/code> function.<\/p>\n\n\n\n<p>From the <code>inner()<\/code> function perspective, its enclosing scope is neither local nor global. And Python calls this a nonlocal scope.<\/p>\n\n\n\n<p>Let&#8217;s modify the <code>outer<\/code> and <code>inner<\/code> functions:<\/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\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">outer<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    message = <span class=\"hljs-string\">'outer function'<\/span>\n    print(message)\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">inner<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n        print(message)\n\n    inner()\n\n\nouter()<\/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><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=ZGVmIG91dGVyKCk6CiAgICBtZXNzYWdlID0gJ291dGVyIGZ1bmN0aW9uJwogICAgcHJpbnQobWVzc2FnZSkKCiAgICBkZWYgaW5uZXIoKToKICAgICAgICBwcmludChtZXNzYWdlKQoKICAgIGlubmVyKCkKCgpvdXRlcigp\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">outer <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>\n<span class=\"hljs-title\">outer<\/span> <span class=\"hljs-title\">function<\/span><\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>When we call the <code>outer<\/code> function, Python creates the <code>inner<\/code> function and executes it.<\/p>\n\n\n\n<p>When the <code>inner<\/code> function executes, Python doesn&#8217;t find the <code>message<\/code> variable in the local scope. So Python looks for it in the enclosing scope, which is the scope of the <code>outer<\/code> function:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"469\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/11\/Python-nonlocal-Scopes.png\" alt=\"\" class=\"wp-image-958\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/11\/Python-nonlocal-Scopes.png 706w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/11\/Python-nonlocal-Scopes-300x199.png 300w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<p>See the following example:<\/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\">message = <span class=\"hljs-string\">'global scope'<\/span>\n\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">outer<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">inner<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n        print(message)\n\n    inner()\n\n\nouter()<\/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><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=bWVzc2FnZSA9ICdnbG9iYWwgc2NvcGUnCgoKZGVmIG91dGVyKCk6CgogICAgZGVmIGlubmVyKCk6CiAgICAgICAgcHJpbnQobWVzc2FnZSkKCiAgICBpbm5lcigpCgoKb3V0ZXIoKQ%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">global<\/span> scope<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, Python searches for the <code>message<\/code> variable in the local scope of the <code>inner<\/code> function.<\/p>\n\n\n\n<p>Since Python doesn&#8217;t find the variable, it searches for the variable in its enclosing scope, which is the scope of the <code>outer<\/code> function.<\/p>\n\n\n\n<p>And in this case, Python goes up to the global scope to find the variable:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"626\" height=\"415\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/11\/Python-nonlocal-Scopes-Variable-Lookup.png\" alt=\"Python nonlocal Scopes - Variable Lookup\" class=\"wp-image-963\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/11\/Python-nonlocal-Scopes-Variable-Lookup.png 626w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/11\/Python-nonlocal-Scopes-Variable-Lookup-300x199.png 300w\" sizes=\"auto, (max-width: 626px) 100vw, 626px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='python-nonlocal-keyword'>Python nonlocal keyword <a href=\"#python-nonlocal-keyword\" class=\"anchor\" id=\"python-nonlocal-keyword\" title=\"Anchor for Python nonlocal keyword\">#<\/a><\/h2>\n\n\n\n<p>To modify variables from a nonlocal scope in a local scope, you use the <code>nonlocal<\/code> keyword. 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\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">outer<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    message = <span class=\"hljs-string\">'outer scope'<\/span>\n    print(message)\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">inner<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n        <span class=\"hljs-keyword\">nonlocal<\/span> message\n        message = <span class=\"hljs-string\">'inner scope'<\/span>\n        print(message)\n\n    inner()\n\n    print(message)\n\n\nouter()<\/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><a href=\"https:\/\/www.pythontutorial.net\/playground\/?q=ZGVmIG91dGVyKCk6CiAgICBtZXNzYWdlID0gJ291dGVyIHNjb3BlJwogICAgcHJpbnQobWVzc2FnZSkKCiAgICBkZWYgaW5uZXIoKToKICAgICAgICBub25sb2NhbCBtZXNzYWdlCiAgICAgICAgbWVzc2FnZSA9ICdpbm5lciBzY29wZScKICAgICAgICBwcmludChtZXNzYWdlKQoKICAgIGlubmVyKCkKCiAgICBwcmludChtZXNzYWdlKQoKCm91dGVyKCk%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">outer scope\ninner scope\ninner scope    <\/code><\/span><\/pre>\n\n\n<p>In this example, we use <code>nonlocal<\/code> keyword to explicitly instruct Python that we&#8217;re modifying a nonlocal variable.<\/p>\n\n\n\n<p>When you use the <code>nonlocal<\/code> keyword for a variable, Python will look for the variable in the enclosing local scopes chain until it first encounters the variable name.<\/p>\n\n\n\n<p>More importantly, Python won&#8217;t look for the variable in the global scope.<\/p>\n\n\n\n<p>Consider the following 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\">message = <span class=\"hljs-string\">'outer scope'<\/span>\n\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">outer<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n    print(message)\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">inner<\/span><span class=\"hljs-params\">()<\/span>:<\/span>\n        <span class=\"hljs-keyword\">nonlocal<\/span> message\n        message = <span class=\"hljs-string\">'inner scope'<\/span>\n        print(message)\n\n    inner()\n\n    print(message)\n\n\nouter()<\/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>If you run this code, you&#8217;ll get the following error:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-built_in\">SyntaxError<\/span>: no binding <span class=\"hljs-keyword\">for<\/span> nonlocal <span class=\"hljs-string\">'message'<\/span> found<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>From inside of the <code>inner<\/code> function, we use the <code>nonlocal<\/code> keyword for the <code>message<\/code> variable.<\/p>\n\n\n\n<p>Therefore, Python searches for the <code>message<\/code> variable in the enclosing scope, which is the scope of the <code>outer<\/code> function.<\/p>\n\n\n\n<p>Since the scope of the <code>outer<\/code> function doesn&#8217;t have <code>message<\/code> variable and Python doesn&#8217;t look further in the global scope, it issues an error:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"469\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/11\/Python-nonlocal-Scopes-nonlocal-variable-lookup.png\" alt=\"Python nonlocal Scopes - nonlocal variable lookup\" class=\"wp-image-961\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/11\/Python-nonlocal-Scopes-nonlocal-variable-lookup.png 706w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/11\/Python-nonlocal-Scopes-nonlocal-variable-lookup-300x199.png 300w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\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 enclosing scopes of inner functions are called nonlocal scopes.<\/li>\n\n\n\n<li>Use the <code>nonlocal<\/code> keyword to modify the variable from the nonlocal scopes.<\/li>\n\n\n\n<li>And Python will look up the nonlocal variables in the enclosing local scopes chain. It won&#8217;t search for the variable in the global scope.<\/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=\"955\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-nonlocal\/\"\n\t\t\t\tdata-post-title=\"Python nonlocal\"\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=\"955\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-nonlocal\/\"\n\t\t\t\tdata-post-title=\"Python nonlocal\"\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 about the Python nonlocal scopes and how to use the nonlocal keyword to change the variables of the nonlocal scopes.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":757,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-955","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/955","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=955"}],"version-history":[{"count":1,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/955\/revisions"}],"predecessor-version":[{"id":7109,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/955\/revisions\/7109"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/757"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}