Python中常见的数据类型

'''
整型:int
浮点型:float
字符串:str
布尔:bool
字典:dict
集合:set
列表:list
元组:tuple
'''
age = 10
print(type(age))#整形

price = 9.9
print(type(price))#浮点型

str1 = '20'
print(type(str1))
str2 = 'hello'
print(type(str2))
str3 = '19.9'
print(type(str3))#字符串(只要有’‘或者“”都为字符串)

f = False
t = True
print(type(f))
print(type(t))#布尔

tom = {'age':18,'call':123456789}
print(type(tom))#字典

tom1 = {'age',18,'call',123456789}
print(type(tom1))#集合

name = ['tony','tom','jack']
print(type(name))#列表

name1 = ('tony','tom','jack')
print(type(name1))#元组
上一篇:1833. 雪糕的最大数量


下一篇:Python format 格式化函数