在Python中有两种函数,一种是def定义的函数,另一种是lambda函数,也就是大家常说的匿名函数。今天我就和大家聊聊lambda函数,在Python编程中,大家习惯将其称为表达式。 1.为什么要用lambda函数? 先举一个例子:将一个列表里的每个元素都平方。 先用def来定义函数,代码如下 ...
分类:
编程语言 时间:
2021-01-26 11:50:43
阅读次数:
0
思路分析 其实就是递归判断左树和右树,但是一些判断条件需要仔细思考下. cpp /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * ...
分类:
其他好文 时间:
2021-01-26 11:49:40
阅读次数:
0
map()函数 map()是 Python 内置的高阶函数,它接收一个函数 f 和一个 list,并通过把函数 f 依次作用在 list 的每个元素上,得到一个新的 list 并返回。 1、当seq只有一个时,将函数func作用于这个seq的每个元素上,并得到一个新的seq。 例如,对于list [ ...
分类:
编程语言 时间:
2021-01-26 11:49:25
阅读次数:
0
import os def remove_filename(path_dir, start, end): files = [f for f in os.listdir(path_dir) if f.startswith(start) and f.endswith(end)] for file_nam ...
分类:
编程语言 时间:
2021-01-26 11:48:41
阅读次数:
0
Power Strings Description Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcde ...
分类:
其他好文 时间:
2021-01-26 11:47:12
阅读次数:
0
@Value和@Autowired这两个注解都是由AutoWiredAnnotationBeanPostProcessor来处理的,这两个注解被处理的地方也是一样的,就是在一个bean被new出来之后,要填充属性的populateBean方法里。 会调用 AutoWiredAnnotationBea ...
分类:
编程语言 时间:
2021-01-25 11:15:20
阅读次数:
0
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-5.0 "Logging": { "MinimumLevel": { "Default": "Debug", "Override": ...
分类:
其他好文 时间:
2021-01-25 11:03:58
阅读次数:
0
Spring的事务管理 Spring的事务管理简化了传统的事务管理流程,提高了开发效率。但是首先先要了解Spring的数据库编程。 Spring的数据库编程 数据库编程是互联网编程的基础,Spring框架为开发者提供了JDBC模板模式,即jdbcTemplate,它可以简化许多代码,但在实际应用中j ...
分类:
编程语言 时间:
2021-01-25 10:59:09
阅读次数:
0
一、linux CPU大小 cat /proc/cpuinfo |grep "model name" && cat /proc/cpuinfo |grep "physical id" 说明:Linux下可以在/proc/cpuinfo中看到每个cpu的详细信息。但是对于双核的cpu,在cpuinfo ...
分类:
系统相关 时间:
2021-01-25 10:49:16
阅读次数:
0
Spring Boot 配置Jackson 编写配置类 @Configuration public class JacksonConfig { @Bean public ObjectMapper objectMapper(){ ObjectMapper objectMapper = new Obje ...
分类:
编程语言 时间:
2021-01-25 10:42:06
阅读次数:
0