L1 = ['Hello', 'World', 18, 'Apple', None] L2 = [] for s in L1: if isinstance(s,str): L2.append(s) print(L2)
Sign in to make a reply
春风十里不如睡你麻痹起来嗨
L1 = ['Hello', 'World', 18, 'Apple', None] L2 = [] for s in L1: if isinstance(s,str): L2.append(s) print(L2)