Malcolm Wooden wrote: > I'm trying to get my head around Python but seem to be failing miserably. I > use RealBasic on a Mac and find it an absolute dream! But Python....UGH!
Strange enough, Rb was one of my first languages, and last time I played with it, I founhd it was close to a nightmare when compared to Python... > > I want to put a sentence of words into an array, eg "This is a sentence of > words" > > 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. <sarcastic> Ho, yes, so simple... only seven lines... </sarcastic> > Now can I see how this is done in Python? - nope! Why not ? a = "This is a sentence of words".split() Now *this* is simplicity, my friend... > UGH! > > Malcolm > (a disillusioned Python newbie) > So I'll leave you to your disi^M^M^Mdelusion... -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list