Simple take the string and pass it to list().
Note: You can’t use the split method for it, because this method needed a separator.
Python split string by character example
Simple example code.
Using List Comprehension
s = "Hello" res = [char for char in s] print(res)
Typecasting to list
Using list function to direct typecasting of string into a list.
s = "Hello" res = list(s) print(res)
Using for loop
This method will print each char, not as a list.
s = "Hello" for c in s: print(c)
Do comment if you have any doubts and suggestions on this Python split topic.
Note: IDE: PyCharm 2021.1.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.