摘要: python-lambda import random f = lambda x, y: x + y print(f(6, 22)) def count_number(a, b, c): return lambda x: a + b + c + x print(count_number(1, 2, 阅读全文
posted @ 2021-07-06 23:08 chron 阅读(49) 评论(0) 推荐(0)
摘要: python-穷举密码 # -*- coding: utf-8 -*- import itertools import time s = time.time() def get_password(digit): password = ( ''.join(x) for x in itertools.p 阅读全文
posted @ 2021-07-06 22:13 chron 阅读(526) 评论(0) 推荐(0)
摘要: python-装饰器 当一个函数中,不同逻辑混杂在一起的时候,程序的可读性会大打折扣。这个时候,可以考虑用一种叫做“装饰器”的东西来重新整理代码。 def xx1(被装饰函数): def xx2(如果被装饰函数有参数那么输入): xxxxxxxxxxxxxxx 被装饰函数(如果被装饰函数有参数那么输 阅读全文
posted @ 2021-07-06 22:12 chron 阅读(54) 评论(0) 推荐(0)