zoukankan      html  css  js  c++  java
  • 吴裕雄--天生自然 PYTHON3开发学习:集合

    fruits = {"apple", "banana", "cherry"}
    fruits.add("orange") 
    print(fruits)
    fruits = {"apple", "banana", "cherry"}
    fruits.clear()
    print(fruits)
    fruits = {"apple", "banana", "cherry"}
    x = fruits.copy()
    print(x)
    x = {"apple", "banana", "cherry"}
    y = {"google", "microsoft", "apple"}
     
    z = x.difference(y) 
     
    print(z)
    x = {"apple", "banana", "cherry"}
    y = {"google", "microsoft", "apple"}
     
    x.difference_update(y) 
     
    print(x)
    fruits = {"apple", "banana", "cherry"}
     
    fruits.discard("banana") 
     
    print(fruits)
    x = {"apple", "banana", "cherry"}
    y = {"google", "runoob", "apple"}
     
    z = x.intersection(y) 
     
    print(z)
    x = {"apple", "banana", "cherry"}
    y = {"google", "runoob", "apple"}
     
    x.intersection_update(y) 
     
    print(x)
    x = {"apple", "banana", "cherry"}
    y = {"google", "runoob", "facebook"}
     
    z = x.isdisjoint(y) 
     
    print(z)
    x = {"apple", "banana", "cherry"}
    y = {"google", "runoob", "apple"}
     
    z = x.isdisjoint(y) 
     
    print(z)
    fruits = {"apple", "banana", "cherry"}
     
    fruits.pop() 
     
    print(fruits)
    fruits = {"apple", "banana", "cherry"}
     
    fruits.remove("banana") 
     
    print(fruits)
    x = {"apple", "banana", "cherry"}
    y = {"google", "runoob", "apple"}
     
    z = x.symmetric_difference(y) 
     
    print(z)
    x = {"apple", "banana", "cherry"}
    y = {"google", "runoob", "apple"}
     
    x.symmetric_difference_update(y) 
     
    print(x)
    x = {"apple", "banana", "cherry"}
    y = {"google", "runoob", "apple"}
     
    z = x.union(y) 
     
    print(z)
    x = {"a", "b", "c"}
    y = {"f", "d", "a"}
    z = {"c", "d", "e"}
     
    result = x.union(y, z) 
     
    print(result)
    x = {"apple", "banana", "cherry"}
    y = {"google", "runoob", "apple"}
     
    z = x.union(y) 
     
    print(z)
    x = {"a", "b", "c"}
    y = {"f", "d", "a"}
    z = {"c", "d", "e"}
     
    result = x.union(y, z) 
     
    print(result)
    x = {"apple", "banana", "cherry"}
    y = {"google", "runoob", "apple"}
     
    x.update(y) 
     
    print(x)
  • 相关阅读:
    JZOJ 1075. 【GDKOI2006】新红黑树
    [CQOI2018]异或序列
    JZOJ 1077. 【GDKOI2006】防御力量
    [TJOI2014]匹配
    JZOJ 1073. 【GDOI2005】山海经
    JZOJ 3745. 【NOI2014模拟7.14】Problem A
    SQL Server 2008 数据库快照
    vSphere 5.0 开发系列(一)vSphere 5.0 环境搭建手顺
    Crm系统帮助
    SQL Server 2008 Entity Data Model 和 Linq to Entities
  • 原文地址:https://www.cnblogs.com/tszr/p/10963246.html
Copyright © 2011-2022 走看看