1.bool 在python里面哪些值是false: 0 “” [] () {} None False
t = True print(type(t))2.int
i = 123 print(type(i))3.float #1e10 #科学计数法也是float
f1 = 1.23 print(type(f1)) f2 = 1e10 print(f2) print(type(f2))4.str 字符串是不可改变的,字符串做了一些操作后,会生成一个新的字符串
s = "abc" print(type(s))5.complex 1+2j
c = 1+2j print(c) print(type(c))6.tuple 只有一个元素的tuple,()中需加个",",不然会被当作元素的类型,而不是tuple类型
t = (1,2,3) print(type(t)) t = (1) print(type(t)) t = (1,) print(type(t))7.list
l = [4,5,6] print(l) print(type(l))8.dict 字典dict中的key必须唯一
d = {"a":1,"b":2} print(d) print(type(d))9.set
s = {1,2,3} print(s) print(type(s))10.frozenset
不可变集合set set和frozenset的区别:frozenset没有add/update/remove等属性 t = frozenset('bookshop') print(t) print(type(t))