8.数据类型

什么数据类型。
int 1,2,3用于计算。
bool:True,False,用户判断。
str:字符串,存储少量数据,进行操作
'fjdsal' '自行车','`13243','fdshklj'
'阿萨德,范德萨,史蒂芬森。。。。'
list:储存大量的数据。
[1,2,3,'首都师范大学','12353234',[1,2,3]]
元祖:只读。
(1,2,3,'第三方',)
dict:字典{'name':'奥德赛','age':16}
字典{'法人':[],'阿萨德':[200,200,200,。。。。。。]}
集合:{1,2,34,'asdf'}
1).int
数字
2).bool
布尔值,Ture和False
3).str
字符串
4).三种数据类型的转换
#int ----> str
i = 1
s = str(i)
#str ---> int
s = '123'
i = int(s)

#int ----->bool  只要是0 ----》False  非0就是True
i = 3
b = bool(i)
print(b)
#bool----> int
#True   1
#False  0
'''
ps:
while True:
    pass
while 1: 效率高
    pass
'''

#str --->bool

#s = "" -----> False
#非空字符串都是True
#s = "0" -----> True

  




posted @ 2019-06-17 15:46  ChengHaier  阅读(121)  评论(0)    收藏  举报