将dict1={'yes':[aa1],'no':[bb1]}这行改写成如下两行代码即可:
col_names = [f'yes{i}' for i in range(
len(aa1))]+[f'no{i}' for i in range(len(bb1))]
dict1={x:y for x,y in zip(col_names,aa1+bb1)}
运行结果:
F:\2021\qa\ot2>t7
yes0 yes1 yes2 yes3 yes4 yes5 ... no37 no38 no39 no40 no41 no42
姓名 张三 1.0 1.0 1.0 1.0 1.0 1.0 ... 0.0 0.0 0.0 0.0 0.0 0.0
李四 1.0 1.0 1.0 1.0 1.0 1.0 ... 0.0 0.0 0.0 0.0 0.0 0.0
如有帮助,请点采纳。