str.split(separator, maxsplit)
method returns a list of strings after breaking the given string by the specified separator.
separator: The is a delimiter. The string splits at this specified separator. It is not provided then any white space is a separator.
maxsplit: It is a number, which tells us to split the string into a maximum of the provided number of times. If it is not provided then there is no limit.
You can do this if you want to split it into a list of single characters.
x='ABCDEFG'
char_list=list(x)
#['A', 'B', 'C', 'D', 'E', 'F', 'G']
If you want to split it into single characters avoiding any spaces then try this.
x='abcde fgh i'
out=[char for string in x.split() for char in string]
#['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
And .split()
doesn't convert your string to a list. In your, it returned ['ABCDEFG]
because the string contains no spaces.