Discuss / Python / 列表生成式 小写

列表生成式 小写

Topic source

ferb2015

#1 Created at ... [Delete] [Delete and Lock User]

L2 = [] for x in L1: if isinstance(x,str) == True: L2.append(x)

L2 = [s.lower() for s in L2]

#法二

#[x.lower() for x in L1 if not isinstance(x,int) if x != None]


  • 1

Reply