python 数据类型 变量

变量:

    可变:list dictionary

    不可变:string 数字 元组

访问顺序:

    直接访问:数字

    顺序访问:字符串, 列表,列表

    映射(速度快,占用空间大):字典

存放元素个数:

    容器类型: list, tuple, dictionary

    原子类型:数字 字符串

集合:{} #区别字典

扫描二维码关注公众号,回复: 1944681 查看本文章

    不同元素(去重复)

    无序

    元素为不可变类型

    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 = ':')


    

猜你喜欢

转载自blog.csdn.net/yzjincsdn/article/details/80872094
今日推荐