sample = ['AAAA','ABCB','CCCC','DDEF']
我需要消除所有的元素,其中每个字符是相同的本身在元素,如AAAAA,CCCCC
output = ['ABCB','DDEF']
sample1 =[]
for i in sample:
for j in i:
if j == j+1: #This needs to be corrected to if all elements in i identical to each other i.e. if all "j's" are the same
sample1.pop(i)
打印样本
编辑以回答评论
相关问题 更多 >
编程相关推荐