📜  如何在python代码示例中检查列表中的类型

📅  最后修改于: 2022-03-11 14:47:24.499000             🧑  作者: Mango

代码示例1
In [3]: lst = (1,2,3)

In [4]: all(isinstance(n, int) for n in lst)
Out[4]: True

In [5]: lst = (1,2,'3')

In [6]: all(isinstance(n, int) for n in lst)
Out[6]: False