Re: Strings for a newbie

2005-05-28 Thread Warren Block
James Hofmann <[EMAIL PROTECTED]> wrote: > Malcolm Wooden dtptypes.com> writes: >> >> 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 PythonUGH! >> >> I want to put a sentence of words into an array, eg

Re: Strings for a newbie

2005-05-28 Thread James Hofmann
Malcolm Wooden dtptypes.com> writes: > > 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 PythonUGH! > > I want to put a sentence of words into an array, eg "This is a sentence of > words" > > In RB it

Re: Strings for a newbie

2005-05-27 Thread Steve Holden
Malcolm Wooden wrote: > Yes Sergei, as 3 of the lines are Dim statements, the real code is just 4 > lines, a totally logical. It's not the amout of code thats a probelm, it's > following the logic and structure thats important. As I said Python.. UGH! > > Malcolm > Yes, the weirdest thing about

Re: Strings for a newbie

2005-05-27 Thread bruno modulix
Malcolm Wooden wrote: (top post corrected) > > "John Machin" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Malcolm Wooden wrote: >> (snip useless rant) >>> >>>I want to put a sentence of words into an array, eg "This is a sentence >>>of words" >>> >>>In RB it would be simple

Re: Strings for a newbie

2005-05-27 Thread bruno modulix
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 PythonUGH! Strange enough, Rb was one of my first languages, and last time I played with it, I founhd it was close to a nightmare whe

Re: Strings for a newbie

2005-05-27 Thread Kalle Anka
Malcolm Wooden dtptypes.com> writes: > 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.a

Re: Strings for a newbie

2005-05-27 Thread Kalle Anka
Malcolm Wooden dtptypes.com> writes: > Yes Sergei, as 3 of the lines are Dim statements, the real code is just 4 > lines, a totally logical. It's not the amout of code thats a probelm, it's > following the logic and structure thats important. As I said Python.. UGH! Since I both use RB and Pyt

RE: Strings for a newbie

2005-05-27 Thread Marc Boeren
Hi Malcolm, > It's not the amout of code thats a probelm, it's following the > logic and structure thats important. > As I said Python.. UGH! Do you find .. s = "This is a sentence of words" .. a = s.split(' ') less readable or logical than .. s = "This is a sentence of words" .. For i = 1

Re: Strings for a newbie

2005-05-27 Thread Malcolm Wooden
Yes Sergei, as 3 of the lines are Dim statements, the real code is just 4 lines, a totally logical. It's not the amout of code thats a probelm, it's following the logic and structure thats important. As I said Python.. UGH! Malcolm "Sergei Organov" <[EMAIL PROTECTED]> wrote in message news:[E

Re: Strings for a newbie

2005-05-27 Thread Wolfram Kraus
Malcolm Wooden wrote: > my actual code is: > > for x in range(len(l)): > h = string.split(l[x]) > > where the sentence string is in an array of one element 'l' > Error is: > > Traceback (most recent call last): > File "", line 34, in ? > File "", line 27, in SentenceText > File "C:\P

Re: Strings for a newbie

2005-05-27 Thread John Machin
Malcolm Wooden wrote: > my actual code is: > > for x in range(len(l)): > h = string.split(l[x]) > > where the sentence string is in an array of one element 'l' > Error is: > > Traceback (most recent call last): > File "", line 34, in ? > File "", line 27, in SentenceText > File "C:\P

Re: Strings for a newbie

2005-05-27 Thread Malcolm Wooden
my actual code is: for x in range(len(l)): h = string.split(l[x]) where the sentence string is in an array of one element 'l' Error is: Traceback (most recent call last): File "", line 34, in ? File "", line 27, in SentenceText File "C:\PYTHON22\lib\string.py", line 122, in split

Re: Strings for a newbie

2005-05-27 Thread John Machin
Malcolm Wooden wrote: > Sorry John but that don't do it for me. Just get errors comming back > > > "John Machin" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> >s = "This is a sentence of words" >a = s.split() >a >> >>['This', 'is', 'a', 'sentence', 'of', 'words

Re: Strings for a newbie

2005-05-27 Thread Malcolm Wooden
Sorry John but that don't do it for me. Just get errors comming back "John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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

Re: Strings for a newbie

2005-05-27 Thread Sergei Organov
"Malcolm Wooden" <[EMAIL PROTECTED]> writes: > 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 PythonUGH! > > I want to put a sentence of words into an array, eg "This is a sentence of > words" > > In R

Re: Strings for a newbie

2005-05-27 Thread Wolfram Kraus
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 PythonUGH! > > I want to put a sentence of words into an array, eg "This is a sentence of > words" > > In RB it would be simple: >

Re: Strings for a newbie

2005-05-27 Thread John Machin
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 PythonUGH! > > I want to put a sentence of words into an array, eg "This is a sentence of > words" > > In RB it would be simple: >

Re: Strings for a newbie

2005-05-27 Thread Mage
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