这个例子演示列表推导式加条件过滤:[n for n in nums if 条件] 一步生成符合条件的新列表,还能用真值过滤空串。适合配合列表推导式教程练习。
[n for n in nums if 条件]