Discuss / Python / 将L2变成除小写字母和L1一样的列表

将L2变成除小写字母和L1一样的列表

Topic source

金钟铉

#1 Created at ... [Delete] [Delete and Lock User]
L1 = ['Hello', 'World', 18, 'Apple', None]
L2 = [s.lower() for s in L1 if isinstance(s,str)]
L3 =[x for x in range(len(L1))if not isinstance(L1[x],str)]
L4 =[L2.insert(y,L1[y]) for y in L3]
print(L2)

  • 1

Reply