變量:
可變:list dictionary
不可變:string 數字 元組
訪問順序:
直接訪問:數字
順序訪問:字符串, 列表,列表
映射(速度快,佔用空間大):字典
存放元素個數:
容器類型: list, tuple, dictionary
原子類型:數字 字符串
集合:{} #區別字典
不同元素(去重複)
無序
元素爲不可變類型
add() pop() remove() discard()
交集:intersection() &
並集: union() |
update() #更新多個值
差集: difference() - difference_update()
交叉補集:symmetric_difference() ^
isdisjoint()
issubset() issuperset()
frozenset()
字符串格式化:
‘my %s is %s’%('book','here')
l = 'i am %(name)s ' % name #括號內標記,無影響
分隔符
print('root','0','0',sep = ':')