L1 = ['Hello', 'World', 18, 'Apple', None]
L2 = [v for v in L1 if isinstance(v,str)]
print(L2)
L3 = [v for v in L1 if type(v)==int]
print(L3)
Sign in to make a reply
Young·飘走的船
L1 = ['Hello', 'World', 18, 'Apple', None]
L2 = [v for v in L1 if isinstance(v,str)]
print(L2)
L3 = [v for v in L1 if type(v)==int]
print(L3)