[EMAIL PROTECTED] wrote: > Thanks so much, a really elegant solution indeed. > > I have another question actually which I'm praying you can help me > with: > > with regards to the .jpg conversion to .jpg]] and .gif -> .gif]] > > this works, but only when .jpg/.gif is on it's own line. > > i.e: > > .jpg > > will get converted to: > > .jpg]] > > but > > Image:test.jpg > > gets converted to: > > [[Image:test.jpg > > rather than > > [[Image:test.jpg]] > > ------------------ > > Hope you can help again! Cheers
It does not do the right thing in all cases, but maybe you can get away with for line in lines: if line.startswith("==="): line = line.rstrip() + "===\n" line = line.replace("--------------------","----") line = line.replace("img:","[[Image:") line = line.replace(".jpg",".jpg]]") line = line.replace(".gif",".gif]]") output_lines.append(line) Peter -- http://mail.python.org/mailman/listinfo/python-list