How do I split a string into a list of characters?

In Python, you can use the built-in list() function to convert a string into a list of characters. Here is an example:

string = "hello"
char_list = list(string)
print(char_list)

This will output the following:

['h', 'e', 'l', 'l', 'o']

Watch a course Python - The Practical Guide

Alternatively, you can also use a for loop to iterate over the string and append each character to a new list.

string = "hello"
char_list = []
for char in string:
    char_list.append(char)
print(char_list)

or use list comprehension

string = "hello"
char_list = [char for char in string]
print(char_list)

Both the above methods will give the same output as the first method.