随笔分类 - python3
摘要:一.两个list差集 a = [1,2,3] b = [2,3] 想要的结果是[1] 下面记录一下三种实现方式: 1. 正常的方式 ret = [] for i in a: if i not in b: ret.append(i) 2.简化版 ret = [ i for i in a if i no
阅读全文
摘要:1.差集 a = [1,2,3] b = [2,3] c = list(set(b).difference(set(a))) # b中有而a中没有的 2 .并集 c = list(set(a).union(set(b))) 3.交集 c=list(set(a).intersection(set(b)
阅读全文
摘要:官网示例文档:http://avro.apache.org/docs/current/gettingstartedpython.html#download_install 需要注意的是,官网给出的是py2.x的示例代码。 py3 需要做一些改动: import avro.schema from av
阅读全文