Python | Split string into list of characters
Given a string, write a Python program to split the characters of the given string into a list.
Examples:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Input : geeks Output : ['g', 'e', 'e', 'k', 's'] Input : Word Output : ['W', 'o', 'r', 'd']
Code #1 : Using List Comprehension
This approach uses list comprehension to convert each character into a list. Using the following syntax you can split the characters of a string into a list.
Python3
# Python3 program to Split string into charactersdef split(word): return [char for char in word] # Driver codeword = 'geeks'print(split(word)) |
['g', 'e', 'e', 'k', 's']
Code #2 : Typecasting to list
Python provides direct typecasting of string into list using list().
Python3
# Python3 program to Split string into charactersdef split(word): return list(word) # Driver codeword = 'geeks'print(split(word)) |
['g', 'e', 'e', 'k', 's']

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

