python-基本数据类型
python-基本数据类型
1. python-基本数据类型
- Python的基本数据类型:
- 整数(int),例如6
- 浮点数(float),例如6.6
- 字符串(str),例如"6","python"
- 布尔值(bool),例如True、False
注:使用type()内建函数查看对象类型。
2. 示例
-
编写示例
#!/usr/bin/env python3 # _*_ coding: utf-8 _*_ # Author:shichao # File: .py INT_test = 6 Float_test = 6.6 Str_test = "abc" test = True print(type(INT_test)) print(type(Float_test)) print(type(Str_test)) print(type(test))
-
运行实例
<class 'int'> <class 'float'> <class 'str'> <class 'bool'>