{"id":75762,"date":"2020-01-28T10:06:18","date_gmt":"2020-01-28T04:36:18","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=75762"},"modified":"2020-01-28T10:06:18","modified_gmt":"2020-01-28T04:36:18","slug":"python-iterators","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/","title":{"rendered":"Python Iterators &#8211; Learn to create your own iterator in Python"},"content":{"rendered":"<p>Today we are going to learn about <strong>Python iterators<\/strong>. They are <strong>used<\/strong> everywhere in Python programming.<\/p>\n<p>Chances are you might have already used them in <strong>loops<\/strong>, <strong>list comprehensions<\/strong>, or <strong>generators<\/strong>. It is important to study what <strong>iterators<\/strong> are and how you can <strong>create<\/strong> your <strong>own iterators<\/strong>.<\/p>\n<p>We will cover everything about iterators in this article. So let\u2019s get started.<\/p>\n<h3>What are Python Iterators?<\/h3>\n<p>In very simple words, <strong>Python iterators<\/strong> are <strong>objects<\/strong> that we can <strong>iterate upon<\/strong>. Iterating means to repeat a process <strong>multiple numbers of times<\/strong>. A <strong>single process<\/strong> is called an <strong>iteration<\/strong>.<\/p>\n<p>In Python, we use iterators to repeat a process like <strong>traversing a sequence<\/strong>.<\/p>\n<p><strong>For example<\/strong>, a <strong>list<\/strong> can be <strong>traversed<\/strong> by reading <strong>one object<\/strong> at a time.<\/p>\n<p>Iterators are used a lot in <strong>for-loops<\/strong>, <strong>lists comprehensions<\/strong>, and <strong>generators in Python<\/strong>.<\/p>\n<h3>Creating a Python Iterator<\/h3>\n<p>The iterator protocol in Python states that an iterable object must implement two methods: <strong>__iter__()<\/strong> and<strong> __next__()<\/strong>.<\/p>\n<p>First, we see how to create a Python iterator using <strong>Python built-in function iter()<\/strong>, and then, later on, we will create a <strong>Python iterator object from scratch<\/strong>.<\/p>\n<p>The iter() function is a <strong>built-in function<\/strong> that is used to create an iterator that we can iterate using the <strong>next() function<\/strong>. First, we create a <strong>sequence<\/strong> of <strong>elements<\/strong> that we want to <strong>iterate<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">nums = [2, 4, 1, 9, 6]<\/pre>\n<p>Then we use the<strong> iter() function<\/strong> to get an <strong>iterable object<\/strong>. The<strong> iter()<\/strong> function <strong>implicitly calls<\/strong> the<strong> __iter__()<\/strong> method.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">nums_iter = iter( nums )\nprint( nums_iter )<\/pre>\n<p>The <strong>iter function<\/strong>, when used on <strong>lists<\/strong>, returns the <strong>list_iterator<\/strong> object.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;list_iterator object at 0x00000258BF9CE5C0&gt;<\/pre>\n<p>The <strong>next() function<\/strong> is <strong>used<\/strong> to <strong>access<\/strong> the <strong>elements<\/strong> from the <strong>iterator<\/strong> one at a time.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">print(next(nums_iter))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">2<\/div>\n<p>Now, when we call the <strong>next() function<\/strong> again, it will <strong>access<\/strong> the next <strong>element<\/strong> in the <strong>list<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">print(next(nums_iter))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">4<\/div>\n<p>Like this, we can <strong>access<\/strong> all the <strong>elements<\/strong> of the <strong>list<\/strong>. But now, let\u2019s see what will happen when the <strong>list<\/strong> comes to an <strong>end<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">print(next(nums_iter))\nprint(next(nums_iter))\nprint(next(nums_iter))\nprint(next(nums_iter))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n9<br \/>\n6<br \/>\nTraceback (most recent call last):<br \/>\n<b>\u00a0\u00a0<\/b>File &#8220;&lt;stdin&gt;&#8221;, line 9, in &lt;module&gt;<br \/>\nStopIteration<\/div>\n<p>As we can see, when we tried to <strong>access<\/strong> the <strong>next element<\/strong>, which <strong>does not exist<\/strong>, so the <strong>Python<\/strong> raises a <strong>StopIteration error<\/strong>.<\/p>\n<p>Alternatively, you can also <strong>traverse<\/strong> the elements using the<strong> __next__()<\/strong> method, and it works the same as the <strong>next() function<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">nums_iter = iter({1,2,3,4,5})\n\nprint(nums_iter.__next__())\nprint(nums_iter.__next__())\nprint(nums_iter.__next__())\nprint(nums_iter.__next__())\nprint(nums_iter.__next__())\nprint(nums_iter.__next__())<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">1<br \/>\n2<br \/>\n3<br \/>\n4<br \/>\n5<br \/>\nTraceback (most recent call last):<br \/>\n<b>\u00a0\u00a0<\/b>File\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &#8220;C:\/Users\/Techvidvan\/AppData\/Local\/Programs\/Python\/Python38-32\/test.py&#8221;, line 8, in &lt;module&gt;<br \/>\n<b>\u00a0\u00a0\u00a0\u00a0<\/b>print(nums_iter.__next__())<br \/>\nStopIteration<\/div>\n<p>The <strong>dir() function<\/strong> can be <strong>used<\/strong> to see the <strong>list<\/strong> of <strong>available<\/strong> <strong>methods<\/strong> on the <strong>iterable object<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">dir(nums_iter)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">[&#8216;__class__&#8217;, &#8216;__delattr__&#8217;, &#8216;__dir__&#8217;, &#8216;__doc__&#8217;, &#8216;__eq__&#8217;, &#8216;__format__&#8217;, &#8216;__ge__&#8217;, &#8216;__getattribute__&#8217;, &#8216;__gt__&#8217;, &#8216;__hash__&#8217;, &#8216;__init__&#8217;, &#8216;__init_subclass__&#8217;, &#8216;__iter__&#8217;, &#8216;__le__&#8217;, &#8216;__length_hint__&#8217;, &#8216;__lt__&#8217;, &#8216;__ne__&#8217;, &#8216;__new__&#8217;, &#8216;__next__&#8217;, &#8216;__reduce__&#8217;, &#8216;__reduce_ex__&#8217;, &#8216;__repr__&#8217;, &#8216;__setattr__&#8217;, &#8216;__setstate__&#8217;, &#8216;__sizeof__&#8217;, &#8216;__str__&#8217;, &#8216;__subclasshook__&#8217;]<\/div>\n<h3>For-loop for Iterators<\/h3>\n<p>You might have already <strong>used<\/strong> the <strong>for-loop<\/strong> in <strong>Python<\/strong>.<\/p>\n<p><strong>Iterators<\/strong> are <strong>working<\/strong> in the <strong>background<\/strong> of a <strong>for-loop<\/strong>. We can use the <strong>for-loop<\/strong> to <strong>iterate<\/strong> <strong>over<\/strong> the <strong>elements<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">for city in (\"Delhi\", \"Punjab\", \"Chennai\", \"Pune\"):\n  print(city)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Delhi<br \/>\nPunjab<br \/>\nChennai<br \/>\nPune<\/div>\n<p>The <strong>for-loop<\/strong> automatically <strong>creates<\/strong> the <strong>iterator<\/strong> for the <strong>tuple<\/strong> and then in each iteration, it <strong>stores<\/strong> the current object in the <strong>city variable<\/strong>.<\/p>\n<p><strong>Lists<\/strong>, <strong>tuples<\/strong>, <strong>sets<\/strong>, <strong>strings<\/strong>, etc are all examples of <strong>iterable elements<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">for character in \"Hello!\":\n  print(character)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">H<br \/>\ne<br \/>\nl<br \/>\nl<br \/>\no<br \/>\n!<\/div>\n<h3>Create your Own Python Iterator<\/h3>\n<p>Now we will see how you can <strong>create<\/strong> your <strong>own iterables<\/strong>.<\/p>\n<p>To <strong>create<\/strong> an <strong>iterator<\/strong> object on your <strong>own<\/strong> it is necessary to implement the<strong> __iter__()<\/strong> and <strong>__next__()<\/strong> methods. The __iter__() method will always return the <strong>iterator object<\/strong> itself. We can <strong>initialize variables<\/strong> in this method. The <strong>__next__()<\/strong> method is <strong>created<\/strong> to return the <strong>next element<\/strong> from the <strong>iterator<\/strong>. To reach the end we must raise the <strong>StopIteration<\/strong> <strong>error<\/strong> in this method.<\/p>\n<h4>Infinite Iterator<\/h4>\n<p>Let\u2019s see an example:<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">class EvenNumbers:\n  def __iter__(self):\n    self.num = 0\n    return self\n\n  def __next__(self):\n    next_num = self.num\n    self.num += 2\n    return self.num\n\nevens = EvenNumbers()\neven_iter = iter(evens)\n\nprint(next(even_iter))\nprint(next(even_iter))\nprint(next(even_iter))\nprint(next(even_iter))\nprint(next(even_iter))\nprint(next(even_iter))<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">2<br \/>\n4<br \/>\n6<br \/>\n8<br \/>\n10<br \/>\n12<\/div>\n<p>Here, the <strong>class EvenNumbers<\/strong> is returning even numbers every time we call the <strong>next() function<\/strong>. This will iterate <strong>infinitely<\/strong> because we haven\u2019t specified the condition when it needs to <strong>stop<\/strong>.<\/p>\n<p>For creating iterators that we want to stop at certain conditions, we will implement the <strong>StopIteration<\/strong> exception in the<strong> __next__()<\/strong> method. We can then use a <strong>for loop<\/strong> to automatically <strong>iterate<\/strong> over <strong>all the elements<\/strong>.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">class EvenNumbers:\n  def __iter__(self):\n    self.num = 0\n    return self\n\n  def __next__(self):\n    if(self.num &lt; 10):\n        next_num = self.num\n        self.num += 2\n        return self.num\n    else:\n        raise StopIteration\n\nevens = EvenNumbers()\neven_iter = iter(evens)\n\nfor n in even_iter:\n    print(n)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">2<br \/>\n4<br \/>\n6<br \/>\n8<br \/>\n10<\/div>\n<h3>Benefits of Using Python Iterators<\/h3>\n<p>The main advantage of using the iterators is that the program is only holding one object at a time from a <strong>sequence<\/strong> or a <strong>collection<\/strong>.<\/p>\n<p><strong>For example<\/strong>, to perform an additional operation on each element of a huge list like<strong> [1334, 5534, 5345, 345, 144, \u2026\u2026. ]<\/strong>. We will only hold <strong>one value<\/strong> at a time to perform operations on. There is no need to keep all the elements of the <strong>list<\/strong> in the <strong>memory<\/strong>. This saves the <strong>resources<\/strong> of <strong>computers<\/strong>.<\/p>\n<h3>Summary<\/h3>\n<p>In this article, we have observed <strong>everything<\/strong> about <strong>iterators<\/strong>. We talked about what are <strong>Python iterators<\/strong>, how you can <strong>iterate<\/strong> the <strong>elements<\/strong> with<strong> for-loop<\/strong> and how you can <strong>create<\/strong> your <strong>own iterators<\/strong>.<\/p>\n<p>Moreover, we understood the <strong>benefits<\/strong> of using <strong>iterators<\/strong> in your <strong>program<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today we are going to learn about Python iterators. They are used everywhere in Python programming. Chances are you might have already used them in loops, list comprehensions, or generators. It is important to&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":75888,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1053],"tags":[1469,1470,1471,1472,1473,1474,1475],"class_list":["post-75762","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-benefits-of-using-python-iterators","tag-create-your-own-python-iterator","tag-creating-a-python-iterator","tag-for-loop-for-iterators","tag-iterators-in-python","tag-python-iterators","tag-what-are-python-iterators"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Iterators - Learn to create your own iterator in Python - TechVidvan<\/title>\n<meta name=\"description\" content=\"Know what are Python iterators, its benefits and for-loop for iterators. Also, learn to create them and then create your own iterator in Python with us.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/python-iterators\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Iterators - Learn to create your own iterator in Python - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Know what are Python iterators, its benefits and for-loop for iterators. Also, learn to create them and then create your own iterator in Python with us.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/python-iterators\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-28T04:36:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/Python-iterators.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Iterators - Learn to create your own iterator in Python - TechVidvan","description":"Know what are Python iterators, its benefits and for-loop for iterators. Also, learn to create them and then create your own iterator in Python with us.","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:\/\/techvidvan.com\/tutorials\/python-iterators\/","og_locale":"en_US","og_type":"article","og_title":"Python Iterators - Learn to create your own iterator in Python - TechVidvan","og_description":"Know what are Python iterators, its benefits and for-loop for iterators. Also, learn to create them and then create your own iterator in Python with us.","og_url":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-01-28T04:36:18+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/Python-iterators.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Python Iterators &#8211; Learn to create your own iterator in Python","datePublished":"2020-01-28T04:36:18+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/"},"wordCount":817,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/Python-iterators.jpg","keywords":["Benefits of Using Python Iterators","Create your Own Python Iterator","Creating a Python Iterator","For-loop for Iterators","iterators in python","Python iterators","What are Python Iterators?"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/python-iterators\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/","url":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/","name":"Python Iterators - Learn to create your own iterator in Python - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/Python-iterators.jpg","datePublished":"2020-01-28T04:36:18+00:00","description":"Know what are Python iterators, its benefits and for-loop for iterators. Also, learn to create them and then create your own iterator in Python with us.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/python-iterators\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/Python-iterators.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/Python-iterators.jpg","width":802,"height":420,"caption":"iterators in python"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/python-iterators\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Python Iterators &#8211; Learn to create your own iterator in Python"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/75762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=75762"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/75762\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/75888"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=75762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=75762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=75762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}