Py学习  »  Python

如何使用Python在列表中查找内容的数据类型?

Luke • 3 年前 • 1189 次点击  

我的代码由以下工作流组成:

if my_list contains dict:
  do_this()
elif my_list contains str:
  do_that()

my_list 包含大量元素。

my_列表 只能包含 dict str 数据类型。

我能找到的最有效的方法是什么 dtype 包含在 ?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/137299
 
1189 次点击  
文章 [ 2 ]  |  最新文章 3 年前