How to Concatenate Strings in Python - Stack Abuse The syntax is: <string>.split (sep,maxsplit) In the above syntax: <string> is any valid Python string, sep is the separator that you'd like to split on. Newline code \n (LF), \r\n (CR + LF). The split () method acts on a string and returns a list of substrings. If you will not use an seperator then python uses space to split string. Parallelism in One Line - Blogomatano aString = "one two three four five six" bList = aString.split () print (bList [1]) The first print function outputs the list created by the split string. Note: Using three single quotes or three double quotes, the escape characters such as newline (\n), tab space (\t) become a part of the string. Output Format : Print the formatted string as explained above. split_and_join has the following . no need of list comprehension here, just ','.join (x.strip () for x in s.split (':')). Incase the String doesn't have newline characters, we have to implement it in other ways to write in multiple lines. Python for loop in one line explained with easy examples This is a quick recap of the concepts. You are given a string. Let's look at an example: >>> word = "hello, world" >>> word.split (',') ['hello', ' world'] The above example splits a String into two words by using comma as the delimiter. It should be specified as a string. Python String rsplit() Method - W3Schools Powerful One-Liner Python codes - GeeksforGeeks The split() method will return a list of the elements in a string. It could be a text also. Integer list: It collects all integers in a list called the integer list, and we cannot join two integer lists in Python using the join() function. Today we're returning to collections, and we're mainly going to talk about converting between strings and other collection types like lists and tuples.