Python isinstance 方法 判断 built-in types(内置类型)技巧

Python isinstance 方法 判断 built-in types(内置类型)技巧

d = {}

isinstance(d, type({}))

isinstance(d, dict)

 

l = []

isinstance(l, type([]))

isinstance(l, list)

 

t = ()

isinstance(t, type(()))

isinstance(t, tuple)

posted @ 2019-01-22 11:24  ibingshan  阅读(492)  评论(0编辑  收藏  举报