python数据类型

 1 '''变量:
 2 python变量类型
 3 数值类型,
 4 字符串类型,
 5 布尔型
 6 元组
 7 列表
 8 字典
 9 集合
10 '''
11 a=10
12 t=type(a)
13 print("10类型:",t)# <class 'int'>
14 
15 a="hello"
16 t=type(a)
17 print("hello类型:",t)#<class 'str'>
18 #布尔型
19 a=True#<class 'bool'>
20 #元组
21 a=(1,2,'hello',(1,2))
22 
23 #列表,可以包含元组,列表
24 a=[1,2,'world',4,(1,2),[1,2,3]]
25 #字典key-value结构
26 a={
27     '整数':10,
28     "字符串":"hello world",
29     "元组":(1,2,3),
30     "列表":[1,2,3,4],
31     "字典":{"字典0":"dict"}
32 }
33 #集合set
34 a={1,2,3,4}

 

posted @ 2022-06-21 15:44  困到很想醒  阅读(21)  评论(0编辑  收藏  举报