[Tutor] Split a string into characters

luke rabidpoobear at gmail.com
Tue Aug 23 03:49:33 CEST 2005

>   How do I split a string like "Hans" into a list of characters
> ['H','a','n','s']?

well you could write your own function...

def splititems(itemlist):
    templist = []
    for item in itemlist:
    return templist

print splititems("Hello")

or even

def splititems(itemlist):
    return [item for item in itemlist]

print splititems("Hello")

well I have to go, I hope that helps you.

More information about the Tutor mailing list