python: set函数
来源:互联网 发布:spark mac 安装 编辑:程序博客网 时间:2024/06/05 15:37
API
set([iterable])
set() 函数创建一个 集合 。
集合中元素 区分大小写,不重复,且按字母表顺序排列。
实验代码
# coding=utf-8beijing = set('Beijing')nanjing = set('Nanjing')# 重复的被删除,并按字母表顺序排列print beijing, nanjing# 交集print beijing & nanjing# 并集print beijing | nanjing# 差集print beijing - nanjingprint nanjing - beijing
打印结果:
set(['B', 'e', 'g', 'i', 'j', 'n']) set(['a', 'g', 'i', 'j', 'n', 'N'])set(['i', 'j', 'g', 'n'])set(['a', 'B', 'e', 'g', 'i', 'j', 'n', 'N'])set(['B', 'e'])set(['a', 'N'])
阅读全文
0 0
- Python-set函数
- Python set()函数
- Python set()函数详解
- python: set函数
- Python-set函数
- python map set函数用法
- Python中set函数的使用
- Python标准库:内置函数set([iterable])
- python基础III(dict、set、函数)
- python中set()函数的用法
- python--set集合下的函数
- 00106 python函数:set()集合
- python set() 函数-leetcode217 contains duplicate
- python中set()函数的用法
- Python Set
- python set
- python set
- python--set
- ORACLE SCOTT 解锁 并修改密码
- 22
- The import javax.servlet cannot be resolved
- 一个多线程例子,使用CountDownLatch
- 如何在cmd java main方法 传入含有中文的参数乱码问题解决
- python: set函数
- iOS App的加固保护原理
- 8大排序算法
- linux下查看所有用户及所有用户组
- JAVA实现微信App支付(二)
- 「MICCAI 2017」Reading Notes
- 无效的DNS配置,导致防火墙服务启动失败
- centos常用命令总结
- 戒