Discuss / Python / 练习

练习

Topic source

搞不懂有的函数要写括号里,有的函要写个点。还以为是lower(a)呢,搞了半天不知道错在哪。

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

  • 1

Reply