{"id":7832,"date":"2020-03-27T23:31:41","date_gmt":"2020-03-27T18:01:41","guid":{"rendered":"https:\/\/tutorials.eyehunts.com\/?p=7832"},"modified":"2021-08-30T18:39:27","modified_gmt":"2021-08-30T13:09:27","slug":"python-convert-list-into-a-space-separated-string-print","status":"publish","type":"post","link":"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/","title":{"rendered":"Python Convert List into a space-separated string &#038; Print"},"content":{"rendered":"\n<p>You can use a <strong>translate() method<\/strong>&nbsp;to Convert the Python list into a space-separated list. Another method is using a <a rel=\"noreferrer noopener\" aria-label=\"join() function (opens in a new tab)\" href=\"https:\/\/tutorial.eyehunts.com\/\/python\/python-join-function-join-strings\/\" target=\"_blank\">join() function<\/a>.<\/p>\n\n\n\n<p>One more way is to apply the list as separate arguments: &#8211; <code>print(*L)<\/code><\/p>\n\n\n\n<p><strong><em>Note:<\/em> <\/strong> <strong>translate()<\/strong> method not work for Python 3 and above versions.<\/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\">Ways Python Convert List to space-separated String<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>string&nbsp;<em>translate()<\/em><\/li><li><em>join()<\/em>&nbsp;function<\/li><li>print(*list_name)<\/li><\/ul>\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>Let&#8217;s see How to print a space-separated list in Python<\/strong><\/h3>\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>1. string&nbsp;<em>translate()<\/em><\/strong><\/h3>\n\n\n\n<p>This method does not work for Python 3 and above versions. So we can do a test it&#8217;s an example.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. <em>join()<\/em>&nbsp;function<\/strong><\/h3>\n\n\n\n<p>The Joint() method returns a string in which the elements of the sequence have been joined by an str separator. <\/p>\n\n\n\n<pre>\nlst = ['EyeHunts', 'Python', 'Tutorial']\nstrlist = ' '.join(lst)\nprint(strlist)\n\n<\/pre>\n\n\n\n<p><strong>Output:<\/strong> EyeHunts Python Tutorial<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. print(*list_name)<\/strong><\/h3>\n\n\n\n<p>This is the easiest method until you need the joined string for something else.  Otherwise, use&nbsp;<code>str.join()<\/code>.<\/p>\n\n\n\n<p><code>print()<\/code>&nbsp;take care of converting each element to a string. You can control the separator by setting the&nbsp;<code>sep<\/code>&nbsp;keyword argument:<\/p>\n\n\n\n<pre>\nlist1 = [1, 2, 3, 4, 5]\nprint(*list1)\n\nlist2 = ['a', 'b', 'c', 'd', 'e']\nprint(*list2)\n\n<\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<p>1 2 3 4 5<br>\na b c d e<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Q: How to Python print list elements on one line?<\/strong><\/h3>\n\n\n\n<p><strong>Answer:<\/strong>  Just use&nbsp;<code>*<\/code>&nbsp;before the list in the <a href=\"https:\/\/tutorial.eyehunts.com\/\/python\/python-print-function-hello-world\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"print method (opens in a new tab)\">print method<\/a>.<\/p>\n\n\n\n<p><code>print(*list)<\/code><\/p>\n\n\n\n<p>This will print the list separated by spaces.<\/p>\n\n\n\n<p>Or if you want comma-separated then use this code:-<\/p>\n\n\n\n<pre>\na = [1, 2, 3, 4, 5]\nprint(*a, sep = ',')\n<\/pre>\n\n\n\n<p>You get this output:&nbsp;<code>1,2,3,4,5<\/code><\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Do comment if you have any doubts and input on this tutorial.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong>&nbsp;This example (Project) is developed in&nbsp;PyCharm 2018.2 (Community Edition)<br>JRE: 1.8.0<br>JVM:&nbsp;<a href=\"https:\/\/openjdk.java.net\/\">OpenJDK<\/a>&nbsp;64-Bit Server VM by JetBrains s.r.o<br>macOS 10.13.6<br><strong>Python&nbsp;3.7<\/strong><br>All&nbsp;<strong>Python Programs<\/strong>&nbsp;are in Python 3, so it may change its different from python 2 or upgraded versions.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>You can use a translate() method&nbsp;to Convert the Python list into a space-separated list. Another method is using a join() function. One more way is to apply the list as separate arguments: &#8211; print(*L) Note: translate() method not work for Python 3 and above versions. Ways Python Convert List to space-separated String string&nbsp;translate() join()&nbsp;function print(*list_name)&hellip;&nbsp;<a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Python Convert List into a space-separated string &#038; Print<\/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":[136,175],"post_series":[],"class_list":["post-7832","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-code","tag-python-convert"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Convert List into a space-separated String | Print() - EyeHunts<\/title>\n<meta name=\"description\" content=\"You can use a translate() method to Convert the Python list into a space-separated list. Another method is using a join() function.\" \/>\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-convert-list-into-a-space-separated-string-print\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Convert List into a space-separated String | Print() - EyeHunts\" \/>\n<meta property=\"og:description\" content=\"You can use a translate() method to Convert the Python list into a space-separated list. Another method is using a join() function.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-27T18:01:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-30T13:09:27+00:00\" \/>\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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/\",\"name\":\"Python Convert List into a space-separated String | Print() - EyeHunts\",\"isPartOf\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\"},\"datePublished\":\"2020-03-27T18:01:41+00:00\",\"dateModified\":\"2021-08-30T13:09:27+00:00\",\"author\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\"},\"description\":\"You can use a translate() method to Convert the Python list into a space-separated list. Another method is using a join() function.\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorial.eyehunts.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Convert List into a space-separated string &#038; Print\"}]},{\"@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 Convert List into a space-separated String | Print() - EyeHunts","description":"You can use a translate() method to Convert the Python list into a space-separated list. Another method is using a join() function.","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-convert-list-into-a-space-separated-string-print\/","og_locale":"en_US","og_type":"article","og_title":"Python Convert List into a space-separated String | Print() - EyeHunts","og_description":"You can use a translate() method to Convert the Python list into a space-separated list. Another method is using a join() function.","og_url":"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/","og_site_name":"Tutorial","article_published_time":"2020-03-27T18:01:41+00:00","article_modified_time":"2021-08-30T13:09:27+00:00","author":"Rohit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rohit","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/","url":"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/","name":"Python Convert List into a space-separated String | Print() - EyeHunts","isPartOf":{"@id":"https:\/\/tutorial.eyehunts.com\/#website"},"datePublished":"2020-03-27T18:01:41+00:00","dateModified":"2021-08-30T13:09:27+00:00","author":{"@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1"},"description":"You can use a translate() method to Convert the Python list into a space-separated list. Another method is using a join() function.","breadcrumb":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/tutorial.eyehunts.com\/python\/python-convert-list-into-a-space-separated-string-print\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorial.eyehunts.com\/"},{"@type":"ListItem","position":2,"name":"Python Convert List into a space-separated string &#038; Print"}]},{"@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":6934,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-print-list-using-loops-maps-4-ways\/","url_meta":{"origin":7832,"position":0},"title":"Python print list &#8211; Using Loops, Maps | 4 Ways","author":"Rohit","date":"November 13, 2019","format":false,"excerpt":"Python List is the most frequently used and very versatile datatypes in Python. It's easy to make a list but how you will do program a python code to print list elements? In this tutorial, we will do a python program only for a print full list. Here are way\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2019\/11\/Python-print-list-Using-Loops-Maps-different-Ways.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2019\/11\/Python-print-list-Using-Loops-Maps-different-Ways.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2019\/11\/Python-print-list-Using-Loops-Maps-different-Ways.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2019\/11\/Python-print-list-Using-Loops-Maps-different-Ways.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2019\/11\/Python-print-list-Using-Loops-Maps-different-Ways.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":2589,"url":"https:\/\/tutorial.eyehunts.com\/python\/convert-list-to-string-python-comma-space-join-map\/","url_meta":{"origin":7832,"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":22584,"url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-take-space-separated-integer-input-in-python-3-example-code\/","url_meta":{"origin":7832,"position":2},"title":"How to take space-separated integer input in Python 3 | Example code","author":"Rohit","date":"November 22, 2021","format":false,"excerpt":"Use input(), map(), and split() functions to take space-separated integer input in Python 3. You have to use list() to convert the map to a list. list(map(int,input().split())) Where: input() accepts a string from STDIN. split() splits the string about the whitespace character and returns a list of strings. map() passes\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"How to take space-separated integer input in Python 3","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/11\/How-to-take-space-separated-integer-input-in-Python-3.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":16403,"url":"https:\/\/tutorial.eyehunts.com\/python\/convert-list-to-string-python-4-example-code\/","url_meta":{"origin":7832,"position":3},"title":"Convert list to string Python | 4 Example code","author":"Rohit","date":"July 12, 2021","format":false,"excerpt":"There are many methods to Convert a list to a string in Python. If the list is a string then you can use the do Iterate through the list use join() method or map() method but if the list is of integers, convert the elements before joining them. Examples convert\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","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/07\/Convert-list-to-string-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":23070,"url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-take-list-input-in-python-in-single-line-example-code\/","url_meta":{"origin":7832,"position":4},"title":"How to take list input in Python in single line | Example code","author":"Rohit","date":"December 11, 2021","format":false,"excerpt":"To take list input in Python in a single line use input() function and split() function. Where the input() function accepts a string, integer, and character input from a user, and the split() function splits an input string by space. # Method 1: Using list comprehension input_list = [int(x) for\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"How to take list input in Python in single line","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-take-list-input-in-Python-in-single-line.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":23041,"url":"https:\/\/tutorial.eyehunts.com\/python\/input-split-python-example-code\/","url_meta":{"origin":7832,"position":5},"title":"Input split Python | Example code","author":"Rohit","date":"December 9, 2021","format":false,"excerpt":"If you want to split input by space or any other splitter then just use the split method with the input function in Python. split slits a string by a space by default, but you can change this behavior: input().split(separator, maxsplit) separator (optional): The delimiter on which the string will\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Input split Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/Input-split-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\/7832","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=7832"}],"version-history":[{"count":1,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/7832\/revisions"}],"predecessor-version":[{"id":18859,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/7832\/revisions\/18859"}],"wp:attachment":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/media?parent=7832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/categories?post=7832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/tags?post=7832"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/post_series?post=7832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}