James Stroud wrote: > import re > records = [] > record = None > counter = 1 > regex = re.compile(r'^(\d+)\. (.*)') > for aline in lines: > m = regex.search(aline) > if m is not None: > recnum, aline = m.groups() > if int(recnum) == counter: > if record is not None: > records.append(record) > record = [aline.strip()] > counter += 1 > continue > record.append(aline.strip()) > > if record is not None: > records.append(record) > > records = [" ".join(r) for r in records]
What do I need to do to get this to run against the text that I have? Is 'lines' meant to be a list of the lines from the original citation file? -- http://mail.python.org/mailman/listinfo/python-list