L1 = ['Hello', 'World', 18, 'Apple', None]
L2 = [x.lower() if isinstance(x,str) else x for x in L1 ]
print(L2)
#打印结果:
['hello', 'world', 18, 'apple', None]
Sign in to make a reply
孤o赦免你
L1 = ['Hello', 'World', 18, 'Apple', None]
L2 = [x.lower() if isinstance(x,str) else x for x in L1 ]
print(L2)
#打印结果:
['hello', 'world', 18, 'apple', None]