Strings for a newbie

Mage mage at mage.hu
Fri May 27 08:09:54 EDT 2005


Malcolm Wooden wrote:

>In RB it would be simple:
>
>Dim s as string
>Dim a(-1) as string
>Dim i as integer
>
>s = "This is a sentence of words"
>For i = 1 to CountFields(s," ")
>  a.append NthField(s," ",i)
>next
>
>That's it an array a() containing the words of the sentence.
>
>Now can I see how this is done in Python? - nope!
>  
>

s = "This is a sentence of words"
print s.split(' ')

	Mage





More information about the Python-list mailing list