L1=['hello','world',18,'Apple',None] L2=[s.lower() for s in L1 if isinstance(s,str)=='Ture'] print(L2)
#或者这样: L1=['hello','world',18,'Apple',None] L2=[s.lower() for s in L1 if isinstance(s,str)==Ture] print(L2)
True 不是 Ture
。。额没看到下面的,你忽略我吧
True不是str类型
Sign in to make a reply
用户0ddywfyiu8
为什么这样不行
L1=['hello','world',18,'Apple',None] L2=[s.lower() for s in L1 if isinstance(s,str)=='Ture'] print(L2)
#或者这样: L1=['hello','world',18,'Apple',None] L2=[s.lower() for s in L1 if isinstance(s,str)==Ture] print(L2)