L = ['Hello','World',18,'Apple',None] M = [ i.lower() for i in L if isinstance(i,str)] print(M)
[s.lower() if isinstance(s,str) else s for s in L] 看下边的才发现没说让把非字符删掉
Sign in to make a reply
无愠无殇