from databaseConn import *
def listCross(a,b):
    '''
    :param a:list1
    :param b:list2
    :return:list交叉排序
    '''
    #print(a,b)
    temp=[]
    flen=len(b) if len(a)>len(b) else len(a)
    print(flen)
    for i in range(flen):
        temp.append(a.pop(0))
        temp.append(b.pop(0))
    temp+=a
    temp+=b
    return temp

def removeRepeat(a):
    '''
    :param a:list
    :return:按顺序去掉重复词
    '''
    temp=list(set(a))
    temp.sort(key=a.index)
    return temp

def mergelist(a):
    '''
    :param a:list
    :return: 嵌套list合并成一个
    '''
    t=itertools.chain.from_iterable(a)
    return list(t)

if __name__ == '__main__':
    a=[1,2,4,2,1,5,8]
    print(removeRepeat(a))
