【发布时间】:2013-12-08 21:05:53
【问题描述】:
我有一个文本行列表:textlines,它是一个字符串列表(以 '\n' 结尾)。
我想删除多次出现的行,不包括仅包含空格、换行符和制表符的行。
换句话说,如果原始列表是:
textlines[0] = "First line\n"
textlines[1] = "Second line \n"
textlines[2] = " \n"
textlines[3] = "First line\n"
textlines[4] = " \n"
输出列表将是:
textlines[0] = "First line\n"
textlines[1] = "Second line \n"
textlines[2] = " \n"
textlines[3] = " \n"
怎么做?
【问题讨论】:
标签: python algorithm list find-occurrences