Hello, I am trying to split a word into an array

For example, "airplane" becomes

Any suggestions?

you could use a set. That would split the word into a set with all individual letters in it or you could go

strings = 'airplane'
letters = []
for letter in strings:
    letters.append(letter)
print letters #['a','i','r','p','l','a','n','e']

There might be a better way to do it but thats what i could come up with. :)

Thanks paul, kickass.

FYI, s = ''.join(letters) would recombine them into "airplane"

>>> s = 'airplane'
>>> list(s)

>>>

For completeness, list comprehension
string="airplane"
now_a_list=[x for x in string]

oh yeah i forgot all about list comprehensions!:$

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.