

{"id":7504,"date":"2018-02-08T08:59:40","date_gmt":"2018-02-08T03:29:40","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=7504"},"modified":"2026-04-22T15:41:04","modified_gmt":"2026-04-22T10:11:04","slug":"python-ordereddict","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/","title":{"rendered":"Python OrderedDict &#8211; Reordering, Delete and Reinsert New OrderedDict"},"content":{"rendered":"<p>We\u2019ve been talking about classes from the Python collections module- Python namedtuple, and Python defaultdict. Today, we base our article on Python OrderedDict, another class in \u2018collections\u2019.<\/p>\n<p>Here we study what Python OrderedDict is with its syntax and examples. Moreover, we will study comparing a regular dictionary and reordering an OrderedDict in Python.<\/p>\n<p>At last, we will cover how to delete and reinsert a key for a new ordereddict, and the popitem method.<\/p>\n<p>So, let&#8217;s start the Python OrderedDict Tutorial.<\/p>\n<h3>What is Python OrderedDict?<\/h3>\n<p>Python OrderedDict is just like a regular dictionary in Python, but it also saves the order in which pairs were added. Actually, it is a subclass of \u2018dict\u2019.<\/p>\n<p><strong>Features of using OrderedDict in Python:<\/strong><\/p>\n<ul>\n<li><strong>Order preservation:<\/strong> It maintains the same sequence since the data was added.<\/li>\n<li><strong>No effect:<\/strong> The values can be changed without affecting the original order.<\/li>\n<li><strong>Equality checks consider order:<\/strong> Both order and content are being checked for equality, but different orders are not equal.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; issubclass(OrderedDict,dict)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<h3>OrderedDict Syntax in Python<\/h3>\n<p>To define an OrderedDict in Python, we import it from the module \u2018collections\u2019. Let us see this Python ordereddict example.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; from collections import OrderedDict<\/pre>\n<p>Then, we call this factory function and assign it to a variable in Python.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d=OrderedDict()<\/pre>\n<p>We now add some key-value pairs to it.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d['a']=1\r\n&gt;&gt;&gt; d['e']=5\r\n&gt;&gt;&gt; d['d']=4\r\n&gt;&gt;&gt; d['b']=2\r\n&gt;&gt;&gt; d['c']=3<\/pre>\n<p>Now, if we access \u2018d\u2019, we see that it preserved the order in which we defined the key-value pairs.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;a&#8217;, 1), (&#8216;e&#8217;, 5), (&#8216;d&#8217;, 4), (&#8216;b&#8217;, 2), (&#8216;c&#8217;, 3)])<\/p>\n<\/div>\n<h3>Comparing to a Regular Dictionary<\/h3>\n<p>Let\u2019s try this with a regular dictionary. If we declared this as a regular dictionary, it would produce the pairs according to how the keys are stored in a hash table.<\/p>\n<p>This depends on a random value to reduce collisions.<\/p>\n<h4>1. Equality<\/h4>\n<p>To a regular dictionary, the order does not matter. Let u take another Python ordereddict example.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; {'a': 1, 'e': 5, 'd': 4, 'b': 2, 'c': 3}=={'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>True<\/p>\n<\/div>\n<p>To Python, these two are equal. Let\u2019s create another OrderedDict, and check if it is the same as the OrderedDict \u2018d\u2019 we defined above.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; e=OrderedDict()\r\n&gt;&gt;&gt; e['a']=1\r\n&gt;&gt;&gt; e['b']=2\r\n&gt;&gt;&gt; e['c']=3\r\n&gt;&gt;&gt; e['d']=4\r\n&gt;&gt;&gt; e['e']=5\r\n&gt;&gt;&gt; e<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;a&#8217;, 1), (&#8216;b&#8217;, 2), (&#8216;c&#8217;, 3), (&#8216;d&#8217;, 4), (&#8216;e&#8217;, 5)])<\/p>\n<\/div>\n<p>Now, let\u2019s check if they\u2019re equal.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d==e<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>False<\/p>\n<\/div>\n<p>As you can see, they\u2019re not.<\/p>\n<h3>How to Reorder Python OrderedDict?<\/h3>\n<p>To reorder a key-value pair to the front or the end of an OrderedDict in Python, we have the move_to_end() method. Look, this is \u2018d\u2019:<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;a&#8217;, 1), (&#8216;e&#8217;, 5), (&#8216;d&#8217;, 4), (&#8216;b&#8217;, 2), (&#8216;c&#8217;, 3)])<\/p>\n<\/div>\n<p>Now, let\u2019s move (\u2018e\u2019,5) to the end.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d.move_to_end('e')\r\n&gt;&gt;&gt; d<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;a&#8217;, 1), (&#8216;d&#8217;, 4), (&#8216;b&#8217;, 2), (&#8216;c&#8217;, 3), (&#8216;e&#8217;, 5)])<\/p>\n<\/div>\n<p>This method takes a key as an argument. But it may also take another argument- \u2018last\u2019. This may take one of two values: True or False.<\/p>\n<p>When true, the item is moved to the end. And when false, it is moved to the front.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d.move_to_end('a',last=True)\r\n&gt;&gt;&gt; d<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;d&#8217;, 4), (&#8216;b&#8217;, 2), (&#8216;c&#8217;, 3), (&#8216;e&#8217;, 5), (&#8216;a&#8217;, 1)])<\/p>\n<\/div>\n<p>Here, we moved (\u2018a\u2019,1) to the end. Now, let\u2019s move it back to the front.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d.move_to_end('a',last=False)\r\n&gt;&gt;&gt; d<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;a&#8217;, 1), (&#8216;d&#8217;, 4), (&#8216;b&#8217;, 2), (&#8216;c&#8217;, 3), (&#8216;e&#8217;, 5)])<\/p>\n<\/div>\n<p>Now, to sort this, we do the following:<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d.move_to_end('b')\r\n&gt;&gt;&gt; d<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;a&#8217;, 1), (&#8216;d&#8217;, 4), (&#8216;c&#8217;, 3), (&#8216;e&#8217;, 5), (&#8216;b&#8217;, 2)])<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d.move_to_end('c')\r\n&gt;&gt;&gt; d<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;a&#8217;, 1), (&#8216;d&#8217;, 4), (&#8216;e&#8217;, 5), (&#8216;b&#8217;, 2), (&#8216;c&#8217;, 3)])<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d.move_to_end('d')\r\n&gt;&gt;&gt; d<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;a&#8217;, 1), (&#8216;e&#8217;, 5), (&#8216;b&#8217;, 2), (&#8216;c&#8217;, 3), (&#8216;d&#8217;, 4)])<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; d.move_to_end('e')\r\n&gt;&gt;&gt; d<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;a&#8217;, 1), (&#8216;b&#8217;, 2), (&#8216;c&#8217;, 3), (&#8216;d&#8217;, 4), (&#8216;e&#8217;, 5)])<\/p>\n<\/div>\n<h3>Assigning a Key Again in Python OrderedDict<\/h3>\n<p>Let\u2019s define a new OrderedDict in Python for this example.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; f=OrderedDict()\r\n&gt;&gt;&gt; f['c']=3\r\n&gt;&gt;&gt; f['e']=5\r\n&gt;&gt;&gt; f['a']=1\r\n&gt;&gt;&gt; f['b']=2\r\n&gt;&gt;&gt; f['d']=4\r\n&gt;&gt;&gt; f<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;c&#8217;, 3), (&#8216;e&#8217;, 5), (&#8216;a&#8217;, 1), (&#8216;b&#8217;, 2), (&#8216;d&#8217;, 4)])<\/p>\n<\/div>\n<p>Now, let\u2019s try changing the value of key \u2018e\u2019.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; f['e']=7\r\n&gt;&gt;&gt; f<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;c&#8217;, 3), (&#8216;e&#8217;, 7), (&#8216;a&#8217;, 1), (&#8216;b&#8217;, 2), (&#8216;d&#8217;, 4)])<\/p>\n<\/div>\n<p>Okay. Since the key \u2018e\u2019 already exists, the old order is preserved; it isn\u2019t ordered to the end.<\/p>\n<h3>Deleting and Reinserting a Key<\/h3>\n<p>When we delete a key and then reinsert it, it is ordered to the end of the new order. Let\u2019s try deleting \u2018e\u2019.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; f.pop('e')<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>7<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt;&gt;&gt; f<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;c&#8217;, 3), (&#8216;a&#8217;, 1), (&#8216;b&#8217;, 2), (&#8216;d&#8217;, 4)])<\/p>\n<\/div>\n<p>Now, let\u2019s insert it again.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&gt;&gt;&gt; f['e']=7\r\n&gt;&gt;&gt; f<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;c&#8217;, 3), (&#8216;a&#8217;, 1), (&#8216;b&#8217;, 2), (&#8216;d&#8217;, 4), (&#8216;e&#8217;, 7)])<\/p>\n<\/div>\n<p>As you can see, it is at the back of the list now.<\/p>\n<h3>Popitem() in Python<\/h3>\n<p>The popitem() method in Python may take 0 or 1 argument- \u2018last\u2019. When \u2018last\u2019 is true, LIFO is followed to delete; otherwise, FIFO is followed. When we don\u2019t pass an argument, the last is assumed to be true.<\/p>\n<p>Let\u2019s take a new Python OrderedDict for this.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; g=OrderedDict()\r\n&gt;&gt;&gt; g['d']=4\r\n&gt;&gt;&gt; g['b']=2\r\n&gt;&gt;&gt; g['a']=1\r\n&gt;&gt;&gt; g['c']=3\r\n&gt;&gt;&gt; g['e']=5\r\n&gt;&gt;&gt; g<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>OrderedDict([(&#8216;d&#8217;, 4), (&#8216;b&#8217;, 2), (&#8216;a&#8217;, 1), (&#8216;c&#8217;, 3), (&#8216;e&#8217;, 5)])<\/p>\n<\/div>\n<p>Now, let\u2019s start popping.<\/p>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; g.popitem(last=False)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(&#8216;d&#8217;, 4)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; g.popitem()<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(&#8216;e&#8217;, 5)<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\">&gt;&gt;&gt; g.popitem(last=True)<\/pre>\n<p><strong>Output<\/strong><\/p>\n<div class=\"code-output\">\n<p>(&#8216;c&#8217;, 3)<\/p>\n<\/div>\n<p>So, this was all about Python OrderedDict Tutorial. Hope you like our explanation.<\/p>\n<h3>Python Interview Questions on OrderedDict<\/h3>\n<p>1. What is an OrderedDict in Python?<\/p>\n<p>2. Why use Python OrderedDict?<\/p>\n<p>3. How is Ordereddict implemented in Python?<\/p>\n<p>4. How to update Ordereddict in Python?<\/p>\n<p>5. Give an example of Python OrderedDict.<\/p>\n<h3>Conclusion<\/h3>\n<p>Hopefully, we\u2019ve covered every important detail about Python orderedDict in this article.<\/p>\n<p>We saw how to define them, Syntax, deleting and reinserting, assigning A key to Python ordereddict, and we saw methods move_to_end(), popitem(), and pop().<\/p>\n<p>OrderedDict kept insertion order before Python 3.7 made that standard, but still offers methods like move_to_end for cache work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ve been talking about classes from the Python collections module- Python namedtuple, and Python defaultdict. Today, we base our article on Python OrderedDict, another class in \u2018collections\u2019. Here we study what Python OrderedDict is&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":36240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[4401,7094,9330,9560,10748,10763,11532,14093,15871],"class_list":["post-7504","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-examples-of-python-ordereddict","tag-introduction-to-python-ordereddict","tag-ordereddict-in-python","tag-popitem-method-in-python","tag-python-ordereddict-syntax","tag-python-popitem","tag-reordering-python-ordereddict","tag-syntax-of-python-ordereddict","tag-what-is-python-ordereddict"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python OrderedDict - Reordering, Delete and Reinsert New OrderedDict - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn about Python OrderedDict with syntax &amp; example, Comparing to a Regular Dictionary, Reordering, Assign, Delete &amp; Reinsert, Popitem method\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-ordereddict\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python OrderedDict - Reordering, Delete and Reinsert New OrderedDict - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn about Python OrderedDict with syntax &amp; example, Comparing to a Regular Dictionary, Reordering, Assign, Delete &amp; Reinsert, Popitem method\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-ordereddict\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-08T03:29:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-22T10:11:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-OrderedDict-01-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python OrderedDict - Reordering, Delete and Reinsert New OrderedDict - DataFlair","description":"Learn about Python OrderedDict with syntax & example, Comparing to a Regular Dictionary, Reordering, Assign, Delete & Reinsert, Popitem method","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:\/\/data-flair.training\/blogs\/python-ordereddict\/","og_locale":"en_US","og_type":"article","og_title":"Python OrderedDict - Reordering, Delete and Reinsert New OrderedDict - DataFlair","og_description":"Learn about Python OrderedDict with syntax & example, Comparing to a Regular Dictionary, Reordering, Assign, Delete & Reinsert, Popitem method","og_url":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2018-02-08T03:29:40+00:00","article_modified_time":"2026-04-22T10:11:04+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-OrderedDict-01-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python OrderedDict &#8211; Reordering, Delete and Reinsert New OrderedDict","datePublished":"2018-02-08T03:29:40+00:00","dateModified":"2026-04-22T10:11:04+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/"},"wordCount":820,"commentCount":2,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-OrderedDict-01-1.jpg","keywords":["examples of python ordereddict","introduction to Python OrderedDict","OrderedDict in Python","popitem method in Python","Python OrderedDict syntax","Python popitem","Reordering Python OrderedDict","Syntax of Python OrderedDict","what is Python OrderedDict"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-ordereddict\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/","url":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/","name":"Python OrderedDict - Reordering, Delete and Reinsert New OrderedDict - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-OrderedDict-01-1.jpg","datePublished":"2018-02-08T03:29:40+00:00","dateModified":"2026-04-22T10:11:04+00:00","description":"Learn about Python OrderedDict with syntax & example, Comparing to a Regular Dictionary, Reordering, Assign, Delete & Reinsert, Popitem method","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-ordereddict\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-OrderedDict-01-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2018\/02\/Python-OrderedDict-01-1.jpg","width":1200,"height":628,"caption":"Python OrderedDict - Reordering, Delete and Reinsert New OrderedDict"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-ordereddict\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python OrderedDict &#8211; Reordering, Delete and Reinsert New OrderedDict"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=7504"}],"version-history":[{"count":17,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7504\/revisions"}],"predecessor-version":[{"id":147776,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/7504\/revisions\/147776"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/36240"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=7504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=7504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=7504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}