Python中的数据类型。
Python中的5中数据类型:
1、Numbers,数字;
2、String,字符串;
3、List,列表;
4、Tuple,元组;
5、Dictionary,字典。
其中,List是最常用的数据类型, Dictionary次之。
举例:
Numbers:
var1 = 1
var2 = 2
String:
str = 'blog in 优快云'
List:
list = ['There', 'are', 7, 'days', 'a', 'week', '.' ]
Tuple:
tuple = ('There', 'are', 7, 'days', 'a', 'week', '.')
Dictionary:
dict = {'name': 'Bob', 'age': '7 years old', 'location': 'New York', 'gender': 'boy', 'hobby': 'playing football'}
说明:以上样例在Pycharm中运行正确。