Discuss / Python / 作业

作业

Topic source

#将一组既包含字符串又包含整数的列全部输出为小写形式

#2017年10月10日14:20:07

* coding: utf-8 *

L1 = ['Hello','World',18,'Apple',None] L2 = [s.lower() for s in L1 if isinstance(s,str) and 1 == 1] print(L2)

输出为: C:\Users\loysaid_yan>"F:\Users\loysaid_yan\AppData\Local\Programs\python course\ liebiaoshengchengshi\test1.py" ['hello', 'world', 'apple']


  • 1

Reply