Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Unique

DrScript
2005-02-01
2013-04-26
  • This script removes all duplicated lines:

    #drscript
    #unique.py
    text = DrDocument.GetText()
    eol = DrDocument.GetEndOfLineCharacter()
    text = text.split(eol)
    #oneliner from German Python Forum (remove from list doubled entries)
    text = eol.join([text[i] for i in xrange(len(text)) if text[i] not in text[:i]])
    DrDocument.SetText(text)