我有一个文本行列表: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"
怎么做 ?