• day14作业


    lis1 = ['name', 'sex', 'age', 'salary']
    res = []
    with open('xz.txt', 'r', encoding='utf-8')as fr:
        for line in fr:
            line = line.strip()
            lis = line.split()
            dic = {k: v for k, v in zip(lis1, lis)}
            res.append((dic))
    res1 = res
    print(res1)
    res2 = max(res1, key=lambda salary: salary['salary'])
    print(res2)
    res3 = min(res1, key=lambda age: age['age'])
    print(res3)
    res4 = map(lambda name: name['name'].title(), res1)
    print(list(res4))
    res5 = filter(lambda info: not info['name'].startswith('a'), res1)
    print(list(res5))
    
    def fb(n, n1=-1, n2=1):
    
    
        n3 = n1 + n2
        print(n3)
        while n > 1:
            n -= 1
        fb(n, n2, n3)
        return
    fb(8)
    
    l=[1,2,[3,[4,5,6,[7,8,[9,10,[11,12,13,[14,15]]]]]]]
    def func1(l):
        while len(l) == 0:
            return
    
        if not isinstance(l[0],list):
            print(l[0])
            func1(l[1:])
        else:
            func1(l[0])
            func1(l[1:])
    func1(l)
    
  • 相关阅读:
    第32周二
    第32周一
    第31周日
    第31周六
    第31周五
    第31周四
    第31周三
    C++中this指针的使用方法.
    ArcPad 10 的安装部署
    UEditor用法
  • 原文地址:https://www.cnblogs.com/shin09/p/11587614.html
Copyright © 2020-2023  润新知