题目:
# -*- coding: utf-8 -*- L1 = ['Hello', 'World', 18, 'Apple', None]
# 期待输出: ['hello', 'world', 'apple']
最简洁的代码完成作业:
[s.lower() for s in L if isinstance(s, str)]
题目:
# -*- coding: utf-8 -*- L1 = ['Hello', 'World', 18, 'Apple', None]
# 期待输出: ['hello', 'world', 'apple']
最简洁的代码完成作业:
[s.lower() for s in L if isinstance(s, str)]
转载于:https://my.oschina.net/hex2016/blog/1552184