type
函數(shù)返回一個(gè)對(duì)象的類型。舉個(gè)例子:
print(type(''))
# Output: <type 'str'>
print(type([]))
# Output: <type 'list'>
print(type({}))
# Output: <type 'dict'>
print(type(dict))
# Output: <type 'type'>
print(type(3))
# Output: <type 'int'>
id()
函數(shù)返回任意不同種類對(duì)象的唯一ID,舉個(gè)例子:
name = "Yasoob"
print(id(name))
# Output: 139972439030304