from ecritureBDD import ecritureBDD

def decoupePacket(lPkt):
    if type(lPkt)!=list:
        print('pas liste')
        return
    if len(lPkt)==0:
        print('liste vide')
        return
    if len(lPkt)==1:
        return decoupePacket(lPkt[0])
    if len(lPkt)==3 and type(lPkt[0])==str:
        return [[lPkt[0],int(lPkt[1]),int(lPkt[2])]]
    else:
        l=[]
        for i in lPkt:
            l+=decoupePacket(i)
        return l

def triPacket(lPkt,connec):
    lNettoyee=decoupePacket(lPkt)
    ecritureBDD(lNettoyee,connec)
