python中for和if else的使用
2015-06-24 16:57
555 查看
In [8]: a = set('abcd') In [9]: b = set('ef') In [10]: def match(x,y): ....: for i in x: ....: for j in y: ....: if i==j: ....: break ....: else: ....: return False ....: return True ....: In [11]: match(a,b) Out[11]: False In [12]: match(a,a) Out[12]: True In [13]: match(a,set('ab')) Out[13]: False In [14]: match(a,set('opqrsa')) Out[14]: False In [15]: match(b,b) Out[15]: True
不知道这个函数是不是能够用来判断两个集合完全一样的功能呢?
求大神。
相关文章推荐
- python:open/文件操作
- python多线程并行实现随机森林
- 程序语言 -- Python编码规范
- 程序语言 -- Python面向对象
- 20150530(Python面试)
- Python函数
- 举例详解Python中smtplib模块处理电子邮件的使用
- Python核心编程笔记--随机数
- python字符串操作
- Python 实现 淘宝秒杀 聚划算 自动提醒 源码
- 关于python中解决中文字符的问题
- 相同数字
- python ftp操作脚本&常用函数
- Python中file.close()方法的使用与否
- python模拟登录有验证码的网站记录
- python 基本类型list、tuple、dict学习
- python相关的基础知识分享
- Python字符串的encode与decode
- 【Python】Python中的下划线
- python activemq操作: consumer