解压缩的值太多或解压缩的值为0

时间:2015-10-28 14:52:43

标签: python list unicode ipython

我有这个代码,我正在尝试使用列表拆分 但要么我得到太多的值来解包或需要超过0值来解包

def edits1(word):
    splits  = [(word[:i], word[i:]) for i in range(len(word) + 1)]

    temp1 = []
    for i in splits:
        temp = list(i)
        for j in range(0,len(temp)):
            temp1.append(temp[j])

    splits = temp1

    for s in splits:
        print s
    #here 
    deletes    = [a + b[1:] for a, b in splits if b]

    return set(deletes)

0 个答案:

没有答案