摘要: Python 求两个文本文件以行为单位的交集 并集 差集 Python 求两个文本文件以行为单位的交集 并集 差集 s1 = set(open('a.txt','r').readlines()) s2 = set(open('b.txt','r').readlines()) print 'ins: 阅读全文
posted @ 2019-06-17 16:53 愚公一山 阅读(93) 评论(0) 推荐(0)
摘要: Python 求两个文本文件以行为单位的交集 并集 差集 s1 = set(open('a.txt','r').readlines()) s2 = set(open('b.txt','r').readlines()) print 'ins: %s'%(s1.intersection(s2)) pri 阅读全文
posted @ 2019-06-17 16:47 愚公一山 阅读(960) 评论(0) 推荐(0)
摘要: python字符串内置函数1、字符串 定义:它是一个有序的字符的集合,用于存储和表示基本的文本信息,‘’或“”或‘’‘ ’‘’中间包含的内容称之为字符串特性:1.只能存放一个值2.不可变3.按照从左到右的顺序定义字符集合,下标从0开始顺序访问,有序补充: 1.字符串的单引号和双引号都无法取消特殊字符 阅读全文
posted @ 2019-06-17 16:34 愚公一山 阅读(185) 评论(0) 推荐(0)
摘要: 1、字符串 2、字符串常用操作 1 2 3 4 5 6 # 1字母处理: .upper() # 全部大写 .lower() # 全部小写 .swapcase() # 大小写互换 .capitalize() # 首字母大写,其余小写 .title() # 首字母大写 1 2 3 4 5 6 # 1字母 阅读全文
posted @ 2019-06-17 16:21 愚公一山 阅读(177) 评论(0) 推荐(0)