L = ['Hello', 'World', 18, 'Apple', None] x = [R.lower() for R in L if isinstance(R,str) is True ] print(x)
输出的结果是['hello', 'world', 'apple'],虽然不会报错了,那怎么还能把18和None,保留呢?
我想要输出的结果是['hello', 'world', 18, 'apple', None]
Sign in to make a reply
叫我绅士yuan
输出的结果是['hello', 'world', 'apple'],虽然不会报错了,那怎么还能把18和None,保留呢?