Thanks everyone. I assumed there was something I had not considered...
list slicing is that thing.
The pyParsing example looks interesting - but for this case, a little
too heavy. It doesn't really warrant including a third party module.
Rob C
--
http://mail.python.org/mailman/listinfo/python-l
Rob Cowie wrote:
> I'm having a bit of trouble with this so any help would be gratefully
> recieved...
>
> After splitting up a url I have a string of the form
> 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
> preceeded by an operator if it is a '-', if it is preceded by n
Gerard Flanagan a écrit :
> Alex Martelli wrote:
>
>>Gerard Flanagan <[EMAIL PROTECTED]> wrote:
>>...
>>
>>>a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ]
>>>
>>>import itertools
>>>
>>>b = list(itertools.islice(a,0,8,2))
>>>c = list(itertools.islice(a,1,8,2))
>>
>>Much as I love i
"Rob Cowie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm having a bit of trouble with this so any help would be gratefully
> recieved...
>
> After splitting up a url I have a string of the form
> 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
> preceeded
Alex Martelli wrote:
> Gerard Flanagan <[EMAIL PROTECTED]> wrote:
> ...
> > a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ]
> >
> > import itertools
> >
> > b = list(itertools.islice(a,0,8,2))
> > c = list(itertools.islice(a,1,8,2))
>
> Much as I love itertools, this specific task wo
James Stroud wrote:
> Gerard Flanagan wrote:
> > Rob Cowie wrote:
> >
> >>I'm having a bit of trouble with this so any help would be gratefully
> >>recieved...
> >>
> >>After splitting up a url I have a string of the form
> >>'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
>
Gerard Flanagan <[EMAIL PROTECTED]> wrote:
...
> a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ]
>
> import itertools
>
> b = list(itertools.islice(a,0,8,2))
> c = list(itertools.islice(a,1,8,2))
Much as I love itertools, this specific task would be best expressed ad
b = a[::2]
c
Bruno Desthuilliers wrote:
> Rob Cowie a écrit :
>
>> I'm having a bit of trouble with this so any help would be gratefully
>> recieved...
>>
>> After splitting up a url I have a string of the form
>> 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
>> preceeded by an operato
Rob Cowie a écrit :
> I'm having a bit of trouble with this so any help would be gratefully
> recieved...
>
> After splitting up a url I have a string of the form
> 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
> preceeded by an operator if it is a '-', if it is preceded b
Gerard Flanagan wrote:
> Rob Cowie wrote:
>
>>I'm having a bit of trouble with this so any help would be gratefully
>>recieved...
>>
>>After splitting up a url I have a string of the form
>>'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
>>preceeded by an operator if it is a
Rob Cowie wrote:
> I'm having a bit of trouble with this so any help would be gratefully
> recieved...
>
> After splitting up a url I have a string of the form
> 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
> preceeded by an operator if it is a '-', if it is preceded by n
Gerard Flanagan wrote:
> Rob Cowie wrote:
> > I'm having a bit of trouble with this so any help would be gratefully
> > recieved...
> >
> > After splitting up a url I have a string of the form
> > 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
> > preceeded by an operator i
Rob Cowie wrote:
> I wish to derive two lists - each containing either tags to be
> included, or tags to be excluded. My idea was to take an element,
> examine what element precedes it and accordingly, insert it into the
> relevant list. However, I have not been successful.
>
> Is there a better wa
Rob Cowie wrote:
> I'm having a bit of trouble with this so any help would be gratefully
> recieved...
>
> After splitting up a url I have a string of the form
> 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be
> preceeded by an operator if it is a '-', if it is preceded by n
14 matches
Mail list logo