[Tutor] Split a string into characters

Alan G alan.gauld at freenet.co.uk
Tue Aug 23 08:29:40 CEST 2005


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

>>> list('fred')
['f', 'r', 'e', 'd']
>>>

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld


More information about the Tutor mailing list