第一版 《《《《《《《《《《《《《《《《《《《《《L1 = ['Hello', 'World', 18, 'Apple', None] L2=[] for s in L1[0:5]:
if isinstance(s,str)==True: L2.append(s) else: pass
print([s.lower() for s in L2])
》》》》》》》》》》》》》》》》》》》》》》》》 第二版 利用python的高级函数,切片,列表生成式''' L1 = ['Hello', 'World', 18, 'Apple', None] print([s.lower() for s in L1 if isinstance(s,str)])
Sign in to make a reply
Atob觉得起个名字真难
第一版 《《《《《《《《《《《《《《《《《《《《《
L1 = ['Hello', 'World', 18, 'Apple', None] L2=[] for s in L1[0:5]:
print([s.lower() for s in L2])
》》》》》》》》》》》》》》》》》》》》》》》》 第二版 利用python的高级函数,切片,列表生成式''' L1 = ['Hello', 'World', 18, 'Apple', None] print([s.lower() for s in L1 if isinstance(s,str)])