joining strings question



Hi all,

I have some data with some categories, titles, subtitles, and a link
to their pdf and I need to join the title and the subtitle for every
file and divide them into their separate groups.

So the data comes in like this:

data = ['RULES', 'title','subtitle','pdf',
'title1','subtitle1','pdf1','NOTICES','title2','subtitle2','pdf','title3','subtitle3','pdf']

What I'd like to see is this:

[RULES', 'title subtitle','pdf', 'title1 subtitle1','pdf1'],
['NOTICES','title2 subtitle2','pdf','title3 subtitle3','pdf'], etc...

I've racked my brain for a while about this and I can't seem to figure
it out. Any ideas would be much appreciated.

Thanks
.



Relevant Pages

  • Re: joining strings question
    ... I have some data with some categories, titles, subtitles, and a link ... to their pdf and I need to join the title and the subtitle for every ... Any other solution will be at best a dirty - and brittle - hack. ...
    (comp.lang.python)
  • Re: joining strings question
    ... I have some data with some categories, titles, subtitles, and a link ... to their pdf and I need to join the title and the subtitle for every ... Therefore I give you one of the ugliest piece of code I've produced in years: ...
    (comp.lang.python)
  • Re: Odd subtitles on DVDs.
    ... The subtitles often seem like ... From the film I watched last night, though, it ... The English subtitles on the Japanese version of My Neighbor Totoro seem ... where no one is saying anything, and sometimes titles for sounds. ...
    (rec.arts.movies.current-films)
  • Re: Titles & Subtitles in TOC
    ... If you use Word's built-in heading Styles for your Titles & Subtitles, the TOC will display whatever numbers are attached to those Styles. ...
    (microsoft.public.word.docmanagement)
  • Re: Subtitles and bylines
    ... approach that your example markup demonstrates. ... Titles *and subtitles* are part of headings, ...
    (comp.infosystems.www.authoring.html)