Skip to content

How to split a word into letters in Python?

def split(word):
    return [char for char in word] 

word = "word"
print(split(word))
#output: ["w", "o", "r", "d"]
See also  Python code snippet - How to change the color of the cursor in tkinter?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.