python separate string by line code example
Example 1: python split string by tab
>>> import re
>>> strs = "foo\tbar\t\tspam"
>>> re.split(r'\t+', strs)
['foo', 'bar', 'spam']
Example 2: how to split a string by character in python
def split(word):
return [char for char in word]
# Driver code
word = 'geeks'
print(split(word))
#Output ['g', 'e', 'e', 'k', 's']