美文网首页
基础篇11-元组和集合

基础篇11-元组和集合

作者: 梦归游子意 | 来源:发表于2017-01-16 17:46 被阅读0次
    • 创建集合 set()和frozenset()
    • 添加操作
    a = set('abc')
    a.add('python')
    print(a)   #{'a','python','c','b'}
    
    a.update('python')
    print(a)   #update()中的参数也是inter()
    
    • 删除a.remove('b')
    • in\not in
    • & | - ^ 交集 并集 差集 对称分差
    • 想了解更多集合内容可以参考此文

    相关文章

      网友评论

          本文标题:基础篇11-元组和集合

          本文链接:https://www.haomeiwen.com/subject/pmjpbttx.html