详解Python中的type()方法的使用
2015-05-21 00:00
1056 查看
type()方法返回传递变量的类型。如果传递变量是字典那么它将返回一个字典类型。
语法
以下是type()方法的语法:
参数
dict -- 这是字典
返回值
此方法返回传递变量的类型。
例子
下面的例子显示type()方法的使用
当我们运行上面的程序,它会产生以下结果:
语法
以下是type()方法的语法:
type(dict)
参数
dict -- 这是字典
返回值
此方法返回传递变量的类型。
例子
下面的例子显示type()方法的使用
#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7}; print "Variable Type : %s" % type (dict)
当我们运行上面的程序,它会产生以下结果:
Variable Type : <type 'dict'>
相关文章推荐
- 详解Python中的type()方法的使用
- python MethodType方法详解和使用--转载--有删改
- Python的hasattr() getattr() setattr() 函数使用方法详解
- Python中hasattr() getattr() setattr() 函数使用方法详解
- Python中支持向量机SVM的使用方法详解
- Python的hasattr() getattr() setattr() 函数使用方法详解
- python中sorted方法和列表的sort方法使用详解
- Python的Django框架中forms表单类的使用方法详解
- Python的hasattr() getattr() setattr() 函数使用方法详解
- Python的hasattr() getattr() setattr() 函数使用方法详解
- 数据爬虫(二):python爬虫中urllib库详解,parse和request使用方法
- 数据爬虫(三):python中requests库使用方法详解
- python中数据爬虫requests库使用方法详解
- python中的sort方法和sorted使用详解
- Python的hasattr() getattr() setattr() 函数使用方法详解
- Python 3.6 性能测试框架Locust安装及使用方法(详解)
- Python的hasattr() getattr() setattr() 函数使用方法详解
- Python的hasattr() getattr() setattr() 函数使用方法详解
- Python的hasattr() getattr() setattr() 函数使用方法详解
- Python的Django框架中forms表单类的使用方法详解