{"id":17885,"date":"2021-08-14T12:00:13","date_gmt":"2021-08-14T06:30:13","guid":{"rendered":"https:\/\/tutorial.eyehunts.com\/?p=17885"},"modified":"2021-08-14T12:00:16","modified_gmt":"2021-08-14T06:30:16","slug":"python-index-of-string-in-list-example-code","status":"publish","type":"post","link":"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/","title":{"rendered":"Python index of string in list | Example code"},"content":{"rendered":"\n<p>Use the<a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-strings-tutorial-example\/\"> index() method<\/a> to get the index value of the string in a list. You can get a single index value from this method. to get the all strings index value use <a href=\"https:\/\/tutorial.eyehunts.com\/python\/write-a-python-program-to-count-number-of-lowercase-characters-in-a-string-take-input-from-the-user\/\">for-loop<\/a>.<\/p>\n\n\n\n<p>Get the index of items in the list syntax.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>list.index(element, start, end)<\/code><\/pre>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example find the index of a string in a list of strings python<\/strong><\/h2>\n\n\n\n<p>Simple example code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>list1 = &#91;\"foo\", \"bar\", \"baz\"]\r\n\r\nprint(list1.index(\"baz\"))\r\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: 2<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Get all index of string index<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>list1 = &#91;\"foo\", \"bar\", \"baz\"]\r\n\r\nfor x in list1:\r\n    print(x, list1.index(x))\r\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"292\" height=\"163\" src=\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-index-of-string-in-list.jpg?resize=292%2C163&#038;ssl=1\" alt=\"Python index of string in list\" class=\"wp-image-17961\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Another method:<\/strong><\/h3>\n\n\n\n<p>Get first list index containing sub-string<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>list1 = &#91;'abc', 'day', 'ghi']\r\n\r\n\r\ndef get_index(the_list, substring):\r\n    for i, s in enumerate(the_list):\r\n        if substring in s:\r\n            return i\r\n    return -1\r\n\r\n\r\nprint(get_index(list1, 'abc'))\r\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>: 0<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Do comment if you have any doubts and suggestions on this Python index list topic.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong> IDE:&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\">PyCharm<\/a>&nbsp;2021.3.3 (Community Edition)<\/p><p>Windows 10<\/p><p><strong>Python 3.10.1<\/strong><\/p><p>All<strong>&nbsp;Python Examples&nbsp;are in&nbsp;Python&nbsp;3<\/strong>, so Maybe its different from python 2 or upgraded versions.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Use the index() method to get the index value of the string in a list. You can get a single index value from this method. to get the all strings index value use for-loop. Get the index of items in the list syntax. Example find the index of a string in a list of strings&hellip;&nbsp;<a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Python index of string in list | Example code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[30],"tags":[165,83,98],"post_series":[],"class_list":["post-17885","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-index","tag-python-list","tag-python-string"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python index of string in list | Example code - EyeHunts<\/title>\n<meta name=\"description\" content=\"Use the index() method to get the index value of the string in a list. You can get a single index value from this method. to get the all...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python index of string in list | Example code - EyeHunts\" \/>\n<meta property=\"og:description\" content=\"Use the index() method to get the index value of the string in a list. You can get a single index value from this method. to get the all...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-14T06:30:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-14T06:30:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-index-of-string-in-list.jpg\" \/>\n<meta name=\"author\" content=\"Rohit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rohit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/\",\"name\":\"Python index of string in list | Example code - EyeHunts\",\"isPartOf\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-index-of-string-in-list.jpg\",\"datePublished\":\"2021-08-14T06:30:13+00:00\",\"dateModified\":\"2021-08-14T06:30:16+00:00\",\"author\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\"},\"description\":\"Use the index() method to get the index value of the string in a list. You can get a single index value from this method. to get the all...\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-index-of-string-in-list.jpg?fit=292%2C163&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-index-of-string-in-list.jpg?fit=292%2C163&ssl=1\",\"width\":292,\"height\":163},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorial.eyehunts.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python index of string in list | Example code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\",\"url\":\"https:\/\/tutorial.eyehunts.com\/\",\"name\":\"Tutorial\",\"description\":\"By EyeHunts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\",\"name\":\"Rohit\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"contentUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971\",\"caption\":\"Rohit\"},\"description\":\"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.\",\"url\":\"https:\/\/tutorial.eyehunts.com\/author\/rohit\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python index of string in list | Example code - EyeHunts","description":"Use the index() method to get the index value of the string in a list. You can get a single index value from this method. to get the all...","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:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/","og_locale":"en_US","og_type":"article","og_title":"Python index of string in list | Example code - EyeHunts","og_description":"Use the index() method to get the index value of the string in a list. You can get a single index value from this method. to get the all...","og_url":"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/","og_site_name":"Tutorial","article_published_time":"2021-08-14T06:30:13+00:00","article_modified_time":"2021-08-14T06:30:16+00:00","og_image":[{"url":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-index-of-string-in-list.jpg","type":"","width":"","height":""}],"author":"Rohit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rohit","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/","url":"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/","name":"Python index of string in list | Example code - EyeHunts","isPartOf":{"@id":"https:\/\/tutorial.eyehunts.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#primaryimage"},"image":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#primaryimage"},"thumbnailUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-index-of-string-in-list.jpg","datePublished":"2021-08-14T06:30:13+00:00","dateModified":"2021-08-14T06:30:16+00:00","author":{"@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1"},"description":"Use the index() method to get the index value of the string in a list. You can get a single index value from this method. to get the all...","breadcrumb":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#primaryimage","url":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-index-of-string-in-list.jpg?fit=292%2C163&ssl=1","contentUrl":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-index-of-string-in-list.jpg?fit=292%2C163&ssl=1","width":292,"height":163},{"@type":"BreadcrumbList","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-index-of-string-in-list-example-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorial.eyehunts.com\/"},{"@type":"ListItem","position":2,"name":"Python index of string in list | Example code"}]},{"@type":"WebSite","@id":"https:\/\/tutorial.eyehunts.com\/#website","url":"https:\/\/tutorial.eyehunts.com\/","name":"Tutorial","description":"By EyeHunts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1","name":"Rohit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/","url":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","contentUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777374971","caption":"Rohit"},"description":"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.","url":"https:\/\/tutorial.eyehunts.com\/author\/rohit\/"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":16395,"url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-make-all-items-in-a-list-lowercase-python-example-code\/","url_meta":{"origin":17885,"position":0},"title":"How to make all items in a list lowercase Python | Example code","author":"Rohit","date":"July 13, 2021","format":false,"excerpt":"Use the string lower() method to convert every element in a list of strings into lowercase in Python. Python list variable that contains strings needed to iterate through the loop and add back lowercase value into a list. Make all items in a list lowercase example in Python Simple python\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"How to make all items in a list lowercase Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/How-to-make-all-items-in-a-list-lowercase-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2589,"url":"https:\/\/tutorial.eyehunts.com\/python\/convert-list-to-string-python-comma-space-join-map\/","url_meta":{"origin":17885,"position":1},"title":"Convert List to String Python | Comma | Space | Join | Map","author":"Rohit","date":"September 25, 2018","format":false,"excerpt":"Convert List to String Python have many ways to do. The most common way by using,' '.join(list_name) where join()\u00a0is a string method and takes a list of items (Numbers or Strings) to join with the string. In this tutorial, we will look one by one at how to\u00a0Convert List to\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Convert List to String Python | Comma | Space | Join | Map Convert List to String Python | Comma | Space | Join | Map Traversal","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/09\/Convert-List-to-String-Python-Comma-Space-Join-Map-Convert-List-to-String-Python-Comma-Space-Join-Map-Traversal.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/09\/Convert-List-to-String-Python-Comma-Space-Join-Map-Convert-List-to-String-Python-Comma-Space-Join-Map-Traversal.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/09\/Convert-List-to-String-Python-Comma-Space-Join-Map-Convert-List-to-String-Python-Comma-Space-Join-Map-Traversal.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/09\/Convert-List-to-String-Python-Comma-Space-Join-Map-Convert-List-to-String-Python-Comma-Space-Join-Map-Traversal.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2018\/09\/Convert-List-to-String-Python-Comma-Space-Join-Map-Convert-List-to-String-Python-Comma-Space-Join-Map-Traversal.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":17767,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-cut-string-example-code\/","url_meta":{"origin":17885,"position":2},"title":"Python cut string | Example code","author":"Rohit","date":"November 10, 2021","format":false,"excerpt":"You can use the split() method to cut strings in Python. The split() method splits a string into a list. The default separator is whitespace but you can use your own like a comma. string.split(separator, maxsplit) After splitting a string use bracket with an index value to get the cut\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python cut string","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/11\/Python-cut-string.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":16454,"url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-capitalize-elements-in-list-python-example-code\/","url_meta":{"origin":17885,"position":3},"title":"How to capitalize elements in list Python | Example code","author":"Rohit","date":"July 13, 2021","format":false,"excerpt":"Use string upper() method to convert every element in a list of strings into uppercase (capitalize) in Python code. Example capitalize elements in list Python Simple python example code. Using an upper() method with Loop Use a Python for loop to iterate through each item in a given list of\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"How to capitalize elements in list Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/How-to-capitalize-elements-in-list-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":17538,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-replace-character-in-a-string-by-index-example-code\/","url_meta":{"origin":17885,"position":4},"title":"Python replace character in a string by index | Example code","author":"Rohit","date":"August 4, 2021","format":false,"excerpt":"A simple way to replace a character in a string by index in python is the slicing method. Python replace character in a string with index Example Simple example code replaces the character at a Specific Position. Where in the example we are taking a string, and replace the character\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python replace character in a string by index","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Python-replace-character-in-a-string-by-index.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":17883,"url":"https:\/\/tutorial.eyehunts.com\/python\/find-index-of-character-in-string-python-example-code\/","url_meta":{"origin":17885,"position":5},"title":"Find index of character in string python | Example code","author":"Rohit","date":"August 14, 2021","format":false,"excerpt":"Use Python find() method to get the index value of character in a given string. This method returns the index of a char inside the string if found. And If the char is not found, it raises an exception. Example find the index of a character in string python Simple\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Find index of character in string python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/08\/Find-index-of-character-in-string-python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/17885","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/comments?post=17885"}],"version-history":[{"count":1,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/17885\/revisions"}],"predecessor-version":[{"id":17965,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/17885\/revisions\/17965"}],"wp:attachment":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/media?parent=17885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/categories?post=17885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/tags?post=17885"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/post_series?post=17885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}