[Tutor] Split a string into characters

Rick Pasotto rick at niof.net
Tue Aug 23 03:54:31 CEST 2005


On Tue, Aug 23, 2005 at 01:18:43PM +1200, Hans Dushanthakumar wrote:
> Hi,
>    A quick one...
>    How do I split a string like "Hans" into a list of characters
> ['H','a','n','s']?
> Note that there are no spaces in the original string.
>    Str.split() without any arguments looks for whitespace as splitting
> character. So, this doesn't serve the purpose.
> And str.split("") appears to be illegal.

list('Hans')

-- 
"History will be kind to me, for I intend to write it."
		-- Winston Churchill
    Rick Pasotto    rick at niof.net    http://www.niof.net


More information about the Tutor mailing list