我们常用type()来查看类型,使用方法如下:

1 a = "zzzq"
2 b = 1
3 c = (1, "zzq123")
4 d = [2, "dlrb"]
5 e = {}
6 a1 = type(a)
7 b1 = type(b)
8 c1 = type(c)
9 d1 = type(d)
10 e1 = type(e)
11 print a1, b1, c1, d1, e1

我们可以看到我们提供了五种类型的变量,使用type()来获取类型并输出它
输出结果:
<type 'str'> <type 'int'> <type 'tuple'> <type 'list'> <type 'dict'>
我们看到了:a的类型是字符串,b的类型是整数,c的类型是元组,d的类型是列表,e的类型是字典