{"id":7921,"date":"2025-04-30T06:29:56","date_gmt":"2025-04-30T06:29:56","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=7921"},"modified":"2025-05-23T07:21:38","modified_gmt":"2025-05-23T07:21:38","slug":"how-to-convert-string-to-list-in-python","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/","title":{"rendered":"How to Convert String to List in Python"},"content":{"rendered":"\n<p>Often Python developers need to convert strings into Lists in Python. There are several ways to do this. You may convert the entire string into a list of individual words, or a string into a list of characters. You may also extract certain specific parts of a string and convert it into a list. In this article, we will learn several different ways to convert string to list in Python.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#How_to_Convert_String_to_List_in_Python\" >How to Convert String to List in Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#1_Using_split\" >1. Using split()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#2_Using_list\" >2. Using list()<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#3_Using_List_Comprehension\" >3. Using List Comprehension<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#4_Using_For_loop\" >4. Using For loop<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#5_Using_Regular_Expressions\" >5. Using Regular Expressions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#6_Using_Chunks\" >6. Using Chunks<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Convert_String_to_List_in_Python\"><\/span>How to Convert String to List in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here are the different ways to convert string to list in Python.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Using_split\"><\/span>1. Using split()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Split() function in Python allows you to split a string into separate substrings, as per your requirement. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">string.split(separator)<\/pre>\n\n\n\n<p>You can call split() function directly from any string literal or variable. Its default delimiter used for splitting, is whitespace character. You can optionally specify the delimiter if it is something else. You can leave it blank if you want to split based on whitespace character.<\/p>\n\n\n\n<p>Here is an example to illustrate it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data='good morning'<br>data2=data.split()<br>print(data2) # output is ['good', 'morning']<\/pre>\n\n\n\n<p>Here is an another example to split a date into its individual components.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data='2025-04-30'<br>data2=data.split('-')<br>print(data2) # output is ['2025', '04', '30']<\/pre>\n\n\n\n<p>Using split() function is useful if you want to split a sentence into a list of individual words. But if you want to split it into individual characters then you need to use other solutions described below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Using_list\"><\/span>2. Using list()<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python also supports built-in function list() which converts a string into a list of characters in Python.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">list(string)<\/pre>\n\n\n\n<p>Here is an example to use list() function to convert a string into a list of separate characters.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data='good morning'<br>data2=list(data)<br>print(data2)  # output is ['g', 'o', 'o', 'd', ' ', 'm', 'o', 'r', 'n', 'i', 'n', 'g']<\/pre>\n\n\n\n<p>This approach is useful if you want to work with individual characters in a string.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Using_List_Comprehension\"><\/span>3. Using List Comprehension<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>List comprehensions provide an efficient and concise way to loop through a string and convert it into a list. Here is an example to convert a string into a list.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data='good morning'<br>data2=[i for i in data]<br>print(data2) # output is ['g', 'o', 'o', 'd', ' ', 'm', 'o', 'r', 'n', 'i', 'n', 'g']<\/pre>\n\n\n\n<p>This solution provides a great advantage that you can easily control the conversion of string to list. Here is an example to convert each letter to uppercase while converting the string into a list, using upper() function.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data='good morning'<br>data2=[i.upper() for i in data]<br>print(data2) # ['G', 'O', 'O', 'D', ' ', 'M', 'O', 'R', 'N', 'I', 'N', 'G']<\/pre>\n\n\n\n<p>Here is an example where we exclude character &#8216;o&#8217; from the conversion and use only the remaining characters in the list.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data='good morning'<br>data2=[i for i in data if i!='o']<br>print(data2) # output is ['g', 'd', ' ', 'm', 'r', 'n', 'i', 'n', 'g']<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Using_For_loop\"><\/span>4. Using For loop<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This is the good old fashioned way of looping through a string using &#8216;for&#8217; statement and then adding individual characters to an empty list.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data='good morning'<br>data2=[]<br>for i in data:<br>    data2.append(i)<br>print(data2)  # output is ['g', 'o', 'o', 'd', ' ', 'm', 'o', 'r', 'n', 'i', 'n', 'g']<\/pre>\n\n\n\n<p>This method is more verbose than the rest but it also gives you superb control over conversion of string to lists. Here is an example to add only alternate characters to the list.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data='good morning'<br>data2=[]<br>for i in range(0,len(data),2):<br>    data2.append(data[i])<br>print(data2) # output is ['g', 'o', ' ', 'o', 'n', 'n']<\/pre>\n\n\n\n<p>Here is an example to convert a string into list where each list item is a pair of consecutive characters.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data='good morning'<br>data2=[]<br>for i in range(0,len(data),2):<br>    data2.append(data[i]+data[i+1])<br>print(data2) # ['go', 'od', ' m', 'or', 'ni', 'ng']<\/pre>\n\n\n\n<p>As you can see, you can use for loops for complex use cases that cannot be solved by directly calling above-mentioned functions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Using_Regular_Expressions\"><\/span>5. Using Regular Expressions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Regular expressions are super useful if you want to extract certain special characters or patterns from a string and add them to a list. Here is an example to extract only letters from a string and store them in a list.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import re<br><br>data = \"good morning1.2.3\"<br>letters = re.findall(r'[a-zA-Z]', data)<br>print(letters)  # Output: ['g', 'o', 'o', 'd', 'm', 'o', 'r', 'n', 'i', 'n', 'g']<\/pre>\n\n\n\n<p>In the above code, we first import <em>re<\/em> Python library to process regular expressions. Then we call findall() function and specify the regular expressions for letters, along with the original string. This returns all the letters as a list.<\/p>\n\n\n\n<p>Here is an example to extract only the digits in a string and store it in a list.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import re<br><br>data = \"good morning1.2.3\"<br>numbers = re.findall(r'\\d', data)<br>print(numbers)  # Output: ['1', '2', '3']<\/pre>\n\n\n\n<p>Here is a <a href=\"https:\/\/www.w3schools.com\/python\/python_regex.asp\">list of regular expressions<\/a> that you can use in Python.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_Using_Chunks\"><\/span>6. Using Chunks<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Sometimes, you may need to <a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-split-list-into-even-chunks-in-python\/\">split a string into chunks<\/a> and add them to a list. We have seen a similar use case above using for loops. Here we will see how to do this using list comprehensions.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data = \"good morning\"<br>chunk_size = 2<br>chunks = [data[i:i+chunk_size] for i in range(0, len(data), chunk_size)]<br>print(chunks) # output is ['go', 'od', ' m', 'or', 'ni', 'ng']<\/pre>\n\n\n\n<p>In the above code, we define chunk_size=2. Then in our list comprehension, we use a list of indexes generated using range() function. We also provide chunk_size as step increment for range. So we get a list of indexes [0, 2, 4, 6 &#8230;]. We iterate from 0 to last index in the list. In each iteration, we use <a href=\"https:\/\/ubiq.co\/tech-blog\/how-slicing-in-python-works\/\" target=\"_blank\" rel=\"noreferrer noopener\">slicing<\/a> to extract a substring starting from a given index, whose length is equal to chunk_size. We add this substring to the list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt several different ways to convert strings to lists in Python. You can use any of these methods, depending on your requirement. If you want to convert a string into a list of words, use split() function. If you want to convert it into a list of individual characters, use list() function. If you want to apply certain conditions or exclude certain characters during conversion, then you can use list comprehension or for loop. If you want to extract certain specific substrings or patterns and convert them into list, then you can use regular expressions.<\/p>\n\n\n\n<p>Also read:<br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-check-if-variable-is-defined-in-python\/\">How to Check if Variable is Defined in Python<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reverse-string-in-python\/\">How to Reverse String in Python<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-compare-strings-in-python\/\">How to Compare Strings in Python<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes Python developers need to convert string to list in Python. Here are the different ways to do this in Python.<\/p>\n","protected":false},"author":1,"featured_media":7944,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[301],"tags":[416],"class_list":["post-7921","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-string-to-list"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Convert String to List in Python - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Sometimes Python developers need to convert string to list in Python. Here are the different ways to do this in Python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Convert String to List in Python - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Sometimes Python developers need to convert string to list in Python. Here are the different ways to do this in Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-30T06:29:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-23T07:21:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/convert-string-to-lists-in-python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"301\" \/>\n\t<meta property=\"og:image:height\" content=\"201\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Convert String to List in Python\",\"datePublished\":\"2025-04-30T06:29:56+00:00\",\"dateModified\":\"2025-05-23T07:21:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/\"},\"wordCount\":825,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/convert-string-to-lists-in-python.jpg?fit=301%2C201&ssl=1\",\"keywords\":[\"string to list\"],\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/\",\"name\":\"How to Convert String to List in Python - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/convert-string-to-lists-in-python.jpg?fit=301%2C201&ssl=1\",\"datePublished\":\"2025-04-30T06:29:56+00:00\",\"dateModified\":\"2025-05-23T07:21:38+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Sometimes Python developers need to convert string to list in Python. Here are the different ways to do this in Python.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/convert-string-to-lists-in-python.jpg?fit=301%2C201&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/convert-string-to-lists-in-python.jpg?fit=301%2C201&ssl=1\",\"width\":301,\"height\":201,\"caption\":\"convert string into lists in Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-convert-string-to-list-in-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Convert String to List in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Convert String to List in Python - Ubiq BI","description":"Sometimes Python developers need to convert string to list in Python. Here are the different ways to do this in Python.","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:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/","og_locale":"en_US","og_type":"article","og_title":"How to Convert String to List in Python - Ubiq BI","og_description":"Sometimes Python developers need to convert string to list in Python. Here are the different ways to do this in Python.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2025-04-30T06:29:56+00:00","article_modified_time":"2025-05-23T07:21:38+00:00","og_image":[{"width":301,"height":201,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/convert-string-to-lists-in-python.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Convert String to List in Python","datePublished":"2025-04-30T06:29:56+00:00","dateModified":"2025-05-23T07:21:38+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/"},"wordCount":825,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/convert-string-to-lists-in-python.jpg?fit=301%2C201&ssl=1","keywords":["string to list"],"articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/","name":"How to Convert String to List in Python - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/convert-string-to-lists-in-python.jpg?fit=301%2C201&ssl=1","datePublished":"2025-04-30T06:29:56+00:00","dateModified":"2025-05-23T07:21:38+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Sometimes Python developers need to convert string to list in Python. Here are the different ways to do this in Python.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/convert-string-to-lists-in-python.jpg?fit=301%2C201&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/convert-string-to-lists-in-python.jpg?fit=301%2C201&ssl=1","width":301,"height":201,"caption":"convert string into lists in Python"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-string-to-list-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Convert String to List in Python"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/04\/convert-string-to-lists-in-python.jpg?fit=301%2C201&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-23L","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/7921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=7921"}],"version-history":[{"count":32,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/7921\/revisions"}],"predecessor-version":[{"id":8346,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/7921\/revisions\/8346"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/7944"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=7921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=7921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=7921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}