随笔分类 - 练习
摘要:#需求: # 一个类 # 对象的属性 : 姓名 性别 年龄 部门 # 员工管理系统 # 内部转岗 python开发 - go开发 # 姓名 性别 年龄 新的部门 # A men 83 python # A men 85 go # 1000个员工 # 如果几个员工对象的姓名和性别相同,这是一个人 # 请对这1000个员工做去重 #用到了set的内层如何实现,先hash,如果hash值一样的...
阅读全文
摘要:# __author: busensei # data: 2018/8/15 from functools import reduce import re def cal_atomexp(atom_exp): # 计算乘除法 if '*' in atom_exp: a, b = atom_exp.split('*') atom_res...
阅读全文
摘要:#方法0.5--- lst1 = [1, 3, 7, 9, 12] lst2 = [4, 8, 9, 13, 15, 19] def merge(a, b): c = [] h = j = 0 while j len(lst2) else 0 while lst1 and lst2: if lst1[0] < lst2[0]: lst3.appe...
阅读全文
摘要:file_log.txt文件内容如下:
阅读全文
摘要:A0 =dict(zip(('a', 'b', 'c', 'd', 'e'), (1, 2, 3, 4, 5))) A1 =range(10) A2 = [ifor iin A1if iin A0] A3 = [A0[s]for sin A0] A4 = [ifor iin A1if iin A3] A5 = {i: i*ifor iin A1} A6 = [[i, i*i]for ...
阅读全文