L1 = ['Hello', 'World', 18, 'Apple', None] L2=[] for x in L1: if isinstance(x, str)==1: L2.append(x.lower())print(L2)
L2=[x.lower() for x in L1 if isinstance(x, str)]
Sign in to make a reply
阿山Zzz
L1 = ['Hello', 'World', 18, 'Apple', None] L2=[] for x in L1: if isinstance(x, str)==1: L2.append(x.lower())
print(L2)