递归处理['a-',['b-',['c','d'],'e-f','d']]

dd = ['a-',['b-',['c','d'],'e-f','d']]
def sss(dd):
    dl=[]
    print('fff',dd)
    for index,var in enumerate(dd):

        if  isinstance(var,str):
            if var.endswith('-'):
                print(var)
                dl.extend([f'{var}{li}' for li in sss(dd[index+1])])
                print(dl)
            else:
                print('xxx',var)
                dl.append(var)
    return dl
d1 = sss(dd)
print(d1)
上一篇:DAY05


下一篇:5G NR SSB概述