L = ['Hello', 'World',18, 'IBM', 'Apple',None] L1 = [x.upper() for x in L if isinstance(x,str)] L2 = [y.lower() for y in L if isinstance(y,str)] print(L1) print(L2)
Sign in to make a reply
旅行的Martin
L = ['Hello', 'World',18, 'IBM', 'Apple',None] L1 = [x.upper() for x in L if isinstance(x,str)] L2 = [y.lower() for y in L if isinstance(y,str)] print(L1) print(L2)