### 练习:使列表中的字符串变为小写。使用lower() L1 = ['Hello', 'World', 18, 'Apple', None] L2 = [s.lower() for s in L1 if isinstance(s, str)] #但是我认为这个答案并不够好,应该小写str同时保留int或float L3 = [s.lower() if isinstance(s, str)=='Ture' else s for s in L1] print(L3)
拼写有误: L3 = [s.lower() if isinstance(s, str)==True else s for s in L1]
拼写有误:
L3 = [s.lower() if isinstance(s, str)==True else s for s in L1]
Sign in to make a reply
皈依土豆教!